如何使用Z3Py dll?

时间:2018-10-27 03:58:44

标签: python dll z3 smt z3py

我试图使用Z3Py dll,但是没有用。这是我的测试程序和错误。我对Python非常陌生,我想我错过了每个人都已经知道的重要部分。

init("z3.dll")

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

NameError:未定义名称'init'

enter image description here

enter image description here

我还尝试了另一种加载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

1 个答案:

答案 0 :(得分:0)

通常,您要做的就是导入z3:

from z3 import *

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

运行此简单脚本会发生什么?