简体   繁体   English

"python中的Z3代码"

[英]Z3 code in python

i have installed both python and Z3 and have set PYTHONPATH with the path of Z3 python directory.我已经安装了 python 和 Z3,并使用 Z3 python 目录的路径设置了 PYTHONPATH。

I import Z3 by running this, from z3 import *我通过运行这个来导入 Z3,从 z3 import *

But after this i am getting a persistent long error message of which ends in the following manner:但在此之后,我收到一个持久的长错误消息,其以下列方式结束:

File "C:\Program Files\Microsoft Research\Z3-4.1\python\z3core.py", line 34, in init
    _lib = ctypes.CDLL(PATH)
  File "C:\Python27\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

Interestingly everything was working till i reinstalled both python and Z3.有趣的是,在我重新安装 python 和 Z3 之前,一切正常。

Your PATH environment variable should be set to include the bin or the x64 directory in the Z3 installation. 您的PATH环境变量应设置为包含Z3安装中的bin或x64目录。 If you are using the 64 bit version of Python you should include the x64 directory. 如果您使用的是64位版本的Python,则应包含x64目录。

Example: 例:

hello.py .... File "C:\\Python27\\lib\\ctypes__init__.py", line 365, in init self._handle = _dlopen(self._name, mode) WindowsError: [Error 126] The specified module could not be found hello.py ....文件“C:\\ Python27 \\ lib \\ ctypes__init __。py”,第365行,在init self._handle = _dlopen(self._name,mode)WindowsError:[错误126]指定的模块不能是发现

set PATH=%PATH%;C:\\Program Files (x86)\\Microsoft Research\\Z3-4.1\\bin 设置PATH =%PATH%; C:\\ Program Files(x86)\\ Microsoft Research \\ Z3-4.1 \\ bin

hello.py Traceback (most recent call last): .... File "C:\\Python27\\lib\\ctypes__init__.py", line 365, in init self._handle = _dlopen(self._name, mode) WindowsError: [Error 193] %1 is not a valid Win32 application 跟踪回调(最近调用最后一次):....文件“C:\\ Python27 \\ lib \\ ctypes__init __。py”,第365行,在init self._handle = _dlopen(self._name,mode)WindowsError:[错误193]%1不是有效的Win32应用程序

set PATH=%PATH%;C:\\Program Files (x86)\\Microsoft Research\\Z3-4.1\\x64 设置PATH =%PATH%; C:\\ Program Files(x86)\\ Microsoft Research \\ Z3-4.1 \\ x64

hello.py hello Z3 hello.py你好Z3

When I had this problem, it turned out to be because I didn't have dlls libz3 was dependent on. 当我遇到这个问题时,原来是因为我没有依赖libz3的dll。 solved by installing Visual C++ Redistributable for Visual Studio 2015 . 通过为Visual Studio 2015安装Visual C ++ Redistributable来解决。

如果您使用 anaconda,使用以下命令就足以安装 z3。

pip install z3-solver

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM