简体   繁体   中英

How do I use the Z3Py dll?

I tried to use the Z3Py dll, but it didn't work. Here are my test programs and errors. I am very new to Python, I think I missed some important part everybody already knows.

init("z3.dll")

Traceback (most recent call last):
File "test5.py", line 1, in <module>
    init("z3.dll")

NameError: name 'init' is not defined

enter image description here

enter image description here

I also tried another way to load the dll:

import ctypes
so = ctypes.WinDLL('./z3.dll')     #for windows
print(so)
s = Solver()

<WinDLL './z3.dll', handle 10000000 at 0x10b15f0>
Traceback (most recent call last):
  File "test5.py", line 5, in <module>
    s = Solver()
NameError: name 'Solver' is not defined

enter image description here

enter image description here

Typically, all you have to do is import z3:

from z3 import *

s = Solver()
x = Int("x")
s.add(x > 5)
s.check()
print s.model()

What happens when you run this simple script?

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.

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