hafizul asad
hafizul asad

Reputation: 527

Z3 code in python

i have installed both python and Z3 and have set PYTHONPATH with the path of Z3 python directory.

I import Z3 by running this, from 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.

Upvotes: 1

Views: 2123

Answers (3)

Nur Imtiazul Haque
Nur Imtiazul Haque

Reputation: 383

If you use anaconda, using the following command would suffice to install z3.

pip install z3-solver

Upvotes: 0

bravesirrobin
bravesirrobin

Reputation: 25

When I had this problem, it turned out to be because I didn't have dlls libz3 was dependent on. solved by installing Visual C++ Redistributable for Visual Studio 2015.

Upvotes: 0

Nikolaj Bjorner
Nikolaj Bjorner

Reputation: 461

Your PATH environment variable should be set to include the bin or the x64 directory in the Z3 installation. If you are using the 64 bit version of Python you should include the x64 directory.

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

set 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

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

hello.py hello Z3

Upvotes: 5

Related Questions