I tried to package a Twisted program with py2exe, but once I run the exe file I built, I got a "No module named resource" error.
我尝试使用py2exe打包一个Twisted程序,但是一旦我运行了我构建的exe文件,我就得到了一个“No module named resource”错误。
And I found the py2exe said:
我发现py2exe说:
The following modules appear to be missing ['FCNTL', 'OpenSSL', 'email.Generator', 'email.Iterators', 'email.Utils', 'pkg_resources', 'pywintypes', 'resource', 'win32api', 'win32con', 'win32event', 'win32file', 'win32pipe', 'win32process', 'win32security']
以下模块似乎缺失['FCNTL','OpenSSL','email.Generator','email.Iterators','email.Utils','pkg_resources','pywintypes','resource','win32api', 'win32con','win32event','win32file','win32pipe','win32process','win32security']
So how do I solve this problem?
那么我该如何解决这个问题呢?
Thanks.
2 个解决方案
#1
10
I've seen this before... py2exe, for some reason, is not detecting that these modules are needed inside the ZIP archive and is leaving them out.
我之前见过这个... py2exe,由于某种原因,没有检测到ZIP存档中需要这些模块并将它们排除在外。
You can explicitly specify modules to include on the py2exe command line:
您可以显式指定要包含在py2exe命令行中的模块:
python setup.py py2exe -p win32com -i twisted.web.resource
Something like that. Read up on the options and experiment.
这样的事情。阅读选项和实验。
#2
0
Had same issue with email module. I got it working by explicitly including modules in setup.py:
与电子邮件模块有同样的问题。我通过在setup.py中明确包含模块来实现它:
OLD setup.py:
setup(console = ['main.py'])
New setup.py:
setup(console = ['main.py'],
options={"py2exe":{"includes":["email.mime.multipart","email.mime.text"]}})
#1
10
I've seen this before... py2exe, for some reason, is not detecting that these modules are needed inside the ZIP archive and is leaving them out.
我之前见过这个... py2exe,由于某种原因,没有检测到ZIP存档中需要这些模块并将它们排除在外。
You can explicitly specify modules to include on the py2exe command line:
您可以显式指定要包含在py2exe命令行中的模块:
python setup.py py2exe -p win32com -i twisted.web.resource
Something like that. Read up on the options and experiment.
这样的事情。阅读选项和实验。
#2
0
Had same issue with email module. I got it working by explicitly including modules in setup.py:
与电子邮件模块有同样的问题。我通过在setup.py中明确包含模块来实现它:
OLD setup.py:
setup(console = ['main.py'])
New setup.py:
setup(console = ['main.py'],
options={"py2exe":{"includes":["email.mime.multipart","email.mime.text"]}})