No module named py2exe

本秂侑毒 提交于 2019-12-12 04:47:52

问题


I've been trying to use py2exe on a completed script for a while now, but it appears something is not going right with my py2exe installation. Importing py2exe fails. Here's the output in the Python Shell:

 Traceback (most recent call last):
 File "<pyshell#0>", line 1, in <module>
 import py2exe
 ImportError: No module named py2exe

I've checked here, and apparently there should be a folder named py2exe in C:\Python27\Lib\site-packages\.

There is not. I've tried uninstalling/reinstalling a few times but to no avail. Any solutions out there?

For the record I'm running Python 2.7 and py2exe 0.6.9 (the most recent version, and it is compatible with Python 2.7.

Answering questions:

Module Path: ['C:\\Python27\\Lib\\idlelib', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']

Downloaded version of py2exe: py2exe-0.6.9.win64-py2.5.amd64.msi When using the 32-bit alternative, I get an error that says Python version 2.7 required, which was not found in the registry. And I do have python added to the PATH.

Update: I had the wrong py2exe installed. That's embarassing. For the record, I had py2exe-0.6.9.win64-py2.5.amd64.msi, when I should have had py2exe-0.6.9.win64-py2.7.amd64.exe


回答1:


Do not include "python" command before the setup.py. This works for me. Just type setup.py py2exe. Note you have to be in the same directory as the python secript you want to turn to executable.



来源:https://stackoverflow.com/questions/9559601/no-module-named-py2exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!