我有一个tkinter
应用程序,我正在通过py2exe
编译成一个.exe
应用程序。
在安装文件中,我将其设置为包括lxml
、urllib
、lxml.html
、ast
和math
。
当我在CMD控制台中运行python setup.py py2exe
时,它编译得很好。然后转到它创建的dist
文件夹,并运行.exe
文件。
当我运行.exe
时,我得到这个弹出窗口。
(来源:gyazo.com)
然后我打开Trader.exe.log
文件,内容如下:
Traceback (most recent call last):
File "Trader.py", line 1, in <module>
File "lxml\html\__init__.pyc", line 42, in <module>
File "lxml\etree.pyc", line 12, in <module>
File "lxml\etree.pyc", line 10, in __load
File "lxml.etree.pyx", line 84, in init lxml.etree (src\lxml\lxml.etree.c:190292)
ImportError: cannot import name _elementpath
包含的here是我的setup.py
文件的副本。
请帮我在这里找到问题。提前谢谢。
看起来
py2exe
没有意识到它应该包含lxml._elementpath
模块,该模块由lxml.etree
有条件地导入。您可以告诉它在您的setup.py
中显式地使用includes
关键字参数包含该模块。Py2exe已经在这个页面上记录了这个错误:http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules
它们也提供了一个可行的解决方案。
相关问题 更多 >
编程相关推荐