Again: Installing Z3 + Python on Windows

The installation issues mentioned in the earlier question are still present. I tried installing Z3 4.3.0 and 4.1 under Windows XP SP3 32-bit and under the 64-bit version of Windows 7. None of the combinations work! I can do " from z3 import * ", but init() fails for the Z3 library. My version of Python is 2.7.3. Python Z3 works autonomously and autonomously, but they do not work together without a lot of complaints.

This will help you get an updated installation recipe that answers the following questions:

What Z3 download (source version, precompiled version) should I use?

Which version of Python should I use?

Which or various Z3 DLLs should be referenced in an init () call? An example will help (including using the source string for paths with spaces).

What Python Z3 source files should be used (some Z3 downloads have * .py files, others have * .pyc files)? Are compiled Python files compatible with more than one version of Python?

How to set PATH and PYTHONPATH?

How to call IDLE wrapper in Python in such a way that Z3 initialization is provided automatically?

Sorry if this sounds like a newbie question, but ...

+1
source share
2 answers

Windows XP does not support streaming local storage in the DLL that Z3 requires. We are currently working on a fix, but in any case, this will mean that you will have to compose your own DLL, even if it is fixed.

On Windows 7, it should work out of the box. However, you need to make sure that either everything or nothing is compiled for 64-bit. If you are using the 32-bit version of python, it will not be able to load the 64-bit DLL and vice versa. Python.org has two downloads, one of which is labeled X86-64, which is a 64-bit version.

Finally, the directory where libz3.dll and * .pyc / py are located should be added to PYTHONPATH. You can install this system-wide (control panel, system, advanced system settings, advanced, environment variables), then IDLE will also see this.

+1
source

Christoph answered correctly. Thanks!

Here are some details that might help others. (be sure to adjust the path accordingly)

Modified idle.bat script of Python 2.7.3 (64-bit) :

 @echo off rem Start IDLE using the appropriate Python interpreter setlocal set PATH=%PATH%;X:\my\Programme\z3-4.3.0-x64\bin set PYTHONPATH=X:\my\Programme\z3-4.3.0-x64\bin set CURRDIR=%~dp0 start "IDLE" "%CURRDIR%..\..\pythonw.exe" "%CURRDIR%idle.pyw" %1 %2 %3 %4 %5 %6 %7 %8 %9 endlocal 

Path z3 must be in PATH and in PYTHONPATH .

The first two statements in the Python/Idle shell:

 from z3 import * init(r"X:\my\Programme\z3-4.3.0-x64\bin\libz3.dll") 

(note the "r", which indicates a raw string with backslashes, treated like regular characters)

+6
source

Source: https://habr.com/ru/post/1201307/


All Articles