py2exe 找不到模块
我有一个包含许多模块和目录的Python项目。要运行的主程序是test_main.py:
import PSI_Core.benchManager as bm
import shutil
import os
manager = bm.benchManager();
我完全按照py2exe的过程为该项目创建一个exe文件。但是一旦创建了exe文件并运行它,它给出错误:
ImportError: No module named PSI_Core.benchManager
有人有 py2exe 的经验吗?成功 ?
I have a python project with many modules and directories.The main program to run is test_main.py:
import PSI_Core.benchManager as bm
import shutil
import os
manager = bm.benchManager();
I follow exacty the procedure for py2exe to create an exe file for this project.But once the exe file is created and I run it , it gives error :
ImportError: No module named PSI_Core.benchManager
Has anybody any experience with py2exe ? Success ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道这不是一个直接的答案,但在尝试让 py2exe 工作半小时后,我放弃并尝试了 cx_Freeze,它效果非常好:
http://cx-freeze.sourceforge.net/cx_Freeze.html
五分钟之内,我就有了一个闪亮的可执行文件在等着我:-)
I know this isn't a direct answer but after half an hour of trying to get py2exe working, I gave up and tried cx_Freeze which works wonderfully:
http://cx-freeze.sourceforge.net/cx_Freeze.html
Within five minutes, I had a shiny executable waiting for me :-)
我对 py2exe 有一些经验,但大部分是无法找到解决问题的正确方法并诉诸解决方法和补丁。但是,您的问题很可能相对简单。如果 py2exe 找不到该模块,我建议您使用安装脚本手动包含模块。下面是它应该是什么样子的示例:
I have some experience with py2exe, but most of it is not being able to find a proper fix to my problems and resorting to workarounds and patches. However, there is a good chance that your problem is relatively simple. If py2exe can't find the module, I suggest you use the setup script to manually include a module. Here is an example of what it should look like: