简体   繁体   English

zipimport.ZipImportError:从py2exe制作的程序中找不到模块

[英]zipimport.ZipImportError: can't find module from program made with py2exe

I have a python program I wrote that I am trying to "compile" with py2exe, everything goes well and the executable is created. 我写了一个python程序,试图用py2exe“编译”,一切顺利,并创建了可执行文件。 The first time I run the program I get this error: 第一次运行程序时,出现此错误:

Traceback (most recent call last): File "IMGui.py", line 13, in ImportError: No module named IMCrypt2 追溯(最近一次调用):文件“ IMGui.py”,在ImportError中的第13行,没有名为IMCrypt2的模块

I found that if I manually add my custom modules to /lib/shared.zip and run the program again, I get THIS error: 我发现,如果我将自定义模块手动添加到/lib/shared.zip并再次运行该程序,则会收到此错误:

Traceback (most recent call last): File "IMGui.py", line 13, in zipimport.ZipImportError: can't find module 'IMCrypt2' 追溯(最近一次调用):zipimport.ZipImportError中的文件“ IMGui.py”,第13行,找不到模块“ IMCrypt2”

I have been doing some extensive googling, 2 solutions I've found on the web were to delete the 'dist' and 'build' folders and try again, and to add "includes":"decimal" to my options, but neither of these solutions have worked for me D= 我一直在进行大量的谷歌搜索,在网络上发现的2个解决方案是删除“ dist”和“ build”文件夹,然后重试,并在我的选项中添加“ includes”:“ decimal”,但都没有这些解决方案对我有用

I'm using python 2.5 (I was using new version, but building with those were giving me other strange runtime errors, and the version I did successfully build on Windows 7 ONLY worked on Windows 7, so I'm trying again using Python 2.5 on Windows XP in an attempt to get a more 'universal' windows executable) 我正在使用python 2.5(我正在使用新版本,但是使用这些版本进行构建会给我带来其他奇怪的运行时错误,而我确实在Windows 7上成功构建的版本仅适用于Windows 7,因此我在尝试再次使用Python 2.5在Windows XP上尝试获取更“通用”的Windows可执行文件)

I'm completely stumped! 我完全陷入了困境! Any help would be greatly appreciated! 任何帮助将不胜感激!

I solved my own problem (kinda), I was able to avoid this error and successfully 'compile' my code by consolidating all my modules in to a single file, so that no custom modules were imported. 我解决了自己的问题(有点),通过将所有模块整合到一个文件中,我避免了此错误并成功地“编译”了我的代码,因此没有导入任何自定义模块。 It resulted in some super messy code, but it worked! 它导致了一些超级凌乱的代码,但是它起作用了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM