Mac OS X 10.10上的Z3 v4.3.2 example.py执行错误

时间:2015-03-19 03:08:57

标签: python z3

我正在尝试在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下载最新来源,以按照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/,并尝试使用arch -x86_64 python example.py的64位python来获得相同的结果。

Using Z3Py With Python 3.3开始,我尝试将libz3.a/dylib/java.dylib个文件复制到/Library/Python/2.7/site-packages,但没有成功。

可能出现什么问题?

1 个答案:

答案 0 :(得分:0)

它与Mac OS支持的64位python有关。 从提示Executing python in 64 bit mode on Mac OS X 10.10开始,我用brew安装了python,现在它工作正常。

bin> /usr/local/Cellar/python/2.7.9/bin/python example.py 
sat
[y = 4, x = 2]