简体   繁体   中英

No module named py2exe

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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