z3 solver的安装(python环境变量的配置)

时间:2024-03-11 09:54:42

0.环境:windows10

1.下载z3:https://github.com/Z3Prover/z3 GitHub客户端clone到本地文件夹 

2.开始菜单VS 2017文件夹,打开适用于 VS 2017 的 x64 本机工具命令提示,命令行中进入 Z3 文件夹,执行命令:

python scripts/mk_make.py -x --python
cd build
nmake

 

  • 进入z3路径:绝对路径 cd C:\WINDOWS 相对路径 cd .\WINDOWS
  • python命令:打开anaconda prompt,执行命令,输出第四个为python路径,加入到我的电脑->属性->高级->环境变量->系统变量,在系统变量里找到PATH,双击PATH,在结尾加上 ;C:\Python27
python
import sys
print(sys.path)

3.安装成功提示

Z3 was successfully built.
"Z3Py scripts can already be executed in the \'build\python\' directory."
"Z3Py scripts stored in arbitrary directories can be executed if the \'build\python\' directory is added to the PYTHONPATH environment variable and the \'build\' directory is added to the PATH environment variable.

 

4.增加PYTHONPATH:我的电脑->属性->高级->环境变量->系统变量->新建 ,变量名PYTHONPATH,路径:上文sys.path输出的路径以分号结尾,加上Z3文件夹下的build\python路径。

5.测试

from z3 import *