我尝试用pyinstaller编译我的python工作,命令:
pyinstaller.py -F zchat_server.py
并收到错误消息:
F:\工作场所\的Python \网络学习\ zchat \ DIST> zchat_server.exe
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "D:\pyinstaller-2.0\PyInstaller\loader\iu.py", line 386, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "D:\pyinstaller-2.0\PyInstaller\loader\iu.py", line 480, in doimport
exec co in mod.__dict__
File "F:\workplace\Python\network-study\zchat\build\pyi.win32\zchat_server\out
00-PYZ.pyz\twisted", line 53, in <module>
File "F:\workplace\Python\network-study\zchat\build\pyi.win32\zchat_server\out
00-PYZ.pyz\twisted", line 37, in _checkRequirements
ImportError: Twisted requires zope.interface 3.6.0 or later: no module named zop
e.interface.
我是新手,我编译我的zchat_view.py(使用wxPython),它工作得很好。 但是对于Twisted,我很困惑。希望有解决方案。
答案 0 :(得分:4)
我对此做了一些研究 - 似乎PyInstaller和Zope存在问题。
以下是一些参考链接:
PyInstaller fails to find module Zope - 此链接还提到了潜在的解决方案。
Pyinstaller can't handle namespace packages correctly, such as zope.interface
希望这些可以帮助您在PyInstaller中找出此错误的解决方法。
回答Glyph的查询 - 您可以通过编辑运行PyInstaller命令生成的spec文件来定义PyInstaller的其他依赖项
答案 1 :(得分:0)
zope.interface
是Twisted的依赖项。 pyinstaller是否有需要声明该依赖项的配置文件?
答案 2 :(得分:0)
我认为包 python-zope-interface 可能对您有所帮助:
yum install python-zope-interface
如果显示:
Package python-zope-interface-4.0.5-1.fc19.x86_64 already installed
and latest version
运行:
yum erase python-zope-interface
yum install python-zope-interface
我尝试过它有效!
答案 3 :(得分:0)
我在pyinstaller命令中添加了--hidden-import = twisted,一切运行良好。
pyinstaller --hidden-import=twisted