Z3 v4.3.2 example.py Mac OS X 10.10 上的执行错误
Z3 v4.3.2 example.py execution error on Mac OS X 10.10
我正在尝试在 Mac OS X 10.10.2.
上构建 Z3 最新版本 (v4.3.2)
正在从 http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?he ProjectName=z3&changeSetId=cee7dd39444c9060186df79c2a2c7f8845de415b to follow the command in http://z3.codeplex.com/SourceControl/latest#README 下载最新源。
CXX=clang++ CC=clang python scripts/mk_make.py
cd build
make
sudo make install
构建和安装似乎没问题,但是,当我尝试 运行 example.py 时,出现了这个错误。
Traceback (most recent call last):
File "example.py", line 3, in <module>
x = Real('x')
File "/Library/Python/2.7/site-packages/z3.py", line 2774, in Real
ctx = _get_ctx(ctx)
File "/Library/Python/2.7/site-packages/z3.py", line 210, in _get_ctx
return main_ctx()
File "/Library/Python/2.7/site-packages/z3.py", line 205, in main_ctx
_main_ctx = Context()
File "/Library/Python/2.7/site-packages/z3.py", line 151, in __init__
conf = Z3_mk_config()
File "/Library/Python/2.7/site-packages/z3core.py", line 1036, in Z3_mk_config
r = lib().Z3_mk_config()
File "/Library/Python/2.7/site-packages/z3core.py", line 24, in lib
raise Z3Exception("init(Z3_LIBRARY_PATH) must be invoked before using Z3-python")
z3types.Z3Exception: init(Z3_LIBRARY_PATH) must be invoked before using Z3-python
Exception AttributeError: "Context instance has no attribute 'lib'" in <bound method Context.__del__ of <z3.Context instance at 0x227800>> ignored
我在环境变量中添加了 export Z3_LIBRARY_PATH=/Library/Python/2.7/site-packages/
,并尝试了 64 位 python 和 arch -x86_64 python example.py
以获得相同的结果。
从 Using Z3Py With Python 3.3,我试图将 libz3.a/dylib/java.dylib
文件复制到 /Library/Python/2.7/site-packages
,但没有成功。
可能出了什么问题?
与MacOS支持的64位python有关。
根据提示 ,我用 brew
安装了 python,现在可以正常工作了。
bin> /usr/local/Cellar/python/2.7.9/bin/python example.py
sat
[y = 4, x = 2]
我正在尝试在 Mac OS X 10.10.2.
上构建 Z3 最新版本 (v4.3.2)正在从 http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?he ProjectName=z3&changeSetId=cee7dd39444c9060186df79c2a2c7f8845de415b to follow the command in http://z3.codeplex.com/SourceControl/latest#README 下载最新源。
CXX=clang++ CC=clang python scripts/mk_make.py
cd build
make
sudo make install
构建和安装似乎没问题,但是,当我尝试 运行 example.py 时,出现了这个错误。
Traceback (most recent call last):
File "example.py", line 3, in <module>
x = Real('x')
File "/Library/Python/2.7/site-packages/z3.py", line 2774, in Real
ctx = _get_ctx(ctx)
File "/Library/Python/2.7/site-packages/z3.py", line 210, in _get_ctx
return main_ctx()
File "/Library/Python/2.7/site-packages/z3.py", line 205, in main_ctx
_main_ctx = Context()
File "/Library/Python/2.7/site-packages/z3.py", line 151, in __init__
conf = Z3_mk_config()
File "/Library/Python/2.7/site-packages/z3core.py", line 1036, in Z3_mk_config
r = lib().Z3_mk_config()
File "/Library/Python/2.7/site-packages/z3core.py", line 24, in lib
raise Z3Exception("init(Z3_LIBRARY_PATH) must be invoked before using Z3-python")
z3types.Z3Exception: init(Z3_LIBRARY_PATH) must be invoked before using Z3-python
Exception AttributeError: "Context instance has no attribute 'lib'" in <bound method Context.__del__ of <z3.Context instance at 0x227800>> ignored
我在环境变量中添加了 export Z3_LIBRARY_PATH=/Library/Python/2.7/site-packages/
,并尝试了 64 位 python 和 arch -x86_64 python example.py
以获得相同的结果。
从 Using Z3Py With Python 3.3,我试图将 libz3.a/dylib/java.dylib
文件复制到 /Library/Python/2.7/site-packages
,但没有成功。
可能出了什么问题?
与MacOS支持的64位python有关。
根据提示 brew
安装了 python,现在可以正常工作了。
bin> /usr/local/Cellar/python/2.7.9/bin/python example.py
sat
[y = 4, x = 2]