I've installed z3-solver package from PyPi in my Python3 environment using Anaconda Prompt ( pip install z3-solver ) and that's it.
The package appears in the site-packages/ directory ( the package has _init__.py and all essential files including z3.py ). However, when I tried running this example from Jupyter Notebook, it returns the following message: NameError : name 'Int' is not defined.
I've only used Anaconda for a short time so I'm not sure how installation works. It's really odd because the 'pip install' command works fine most of the times. Did I do something wrong or this package requires more configuration?
You can run conda install pip
and then run the pip install z3-solver
.
Sorry for the late update.
I've managed to solve the problem based on this guide .
To permanently change the sys.path
variable in Anaconda,
I created a .PTH file
which contains the path to z3
and put it in site-packages directory.
You might need to copy the libz3.dll
file to the right directory in order for it to work. Running pip install z3-solver
does download the required files and put them in site-packages but I can't import z3
from anywhere.
Maybe you also need to fix the path after using pip so Anaconda can recognize it. I did everything manually so I'm not sure why pip doesn't work in this case.
That's all I did to install z3
on my Windows
. Hope it helps !
you have to write:
from z3 import *
which solved my NameError: name 'Solver' is not defined
Exception
prerequisites:
pip install z3
pip install z3-solver
code example
from z3 import *
def main():
s = Solver()
x = Int('x')
y = Int('y')
s.add(x < 10)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.