ImportError: no module named py2exe

前端 未结 6 442
旧巷少年郎
旧巷少年郎 2020-12-18 23:41

I get this error when I try to use one of the py2exe samples with py2exe.

File \"setup.py\", line 22, in ?
   import py2exe
ImportError: no module named py2e         


        
相关标签:
6条回答
  • 2020-12-19 00:05

    For the record, my very similar problem was caused by using a Cygwin prompt. Using as standard cmd.exe shell instead worked (given all paths and correctly installed versions of python).

    This was because (stupid me) the Cygwin install had pulled down it's own version of /usr/bin/python. I equally fixed it by adding the Windows installed python location to the head of the Cygwin PATH=/cygdrive/c/Python27:$PATH.

    0 讨论(0)
  • 2020-12-19 00:09

    Sounds like something has installed Python 2.4.3 behind your back, and set that to be the default.

    Short term, try running your script explicitly with Python 2.6 like this:

    c:\Python26\python.exe setup.py ...
    

    Long term, you need to check your system PATH (which it sounds like you've already done) and your file associations, like this:

    C:\Users\rjh>assoc .py
    .py=Python.File
    
    C:\Users\rjh>ftype Python.File
    Python.File="C:\Python26\python.exe" "%1" %*
    

    Simply removing Python 2.4.3 might be a mistake, as presumably something on your system is relying on it. Changing the PATH and file associations to point to Python 2.6 probably won't break whatever thing that is, but I couldn't guarantee it.

    0 讨论(0)
  • 2020-12-19 00:09

    Seems like you need to download proper py2exe distribution.

    Check out if your c:\Python26\Lib\site-packages\ contains py2exe folder.

    0 讨论(0)
  • 2020-12-19 00:21

    You might need to install the py2exe module globally, perhaps you might have installed to a virtualenv. I had the same problem, installing the module globally fixed the problem

    0 讨论(0)
  • 2020-12-19 00:22

    I had the exact same issue and I just managed to get it solved - so I thought I would share my solution.

    It turned out that my installation of CollabNet SVN contained an old version of Python that interfered with my recent Python2.7 installation.

    Replacing CollabNet SVN with VisualSVN (including a couple of reboots) did the trick. I know this is not a "pretty" solution, as it caused me to uninstall CollabNet SVN - a prettier solution might have been doing modifications to the PATH env. variable... However, I am now able to use py2exe :)

    0 讨论(0)
  • 2020-12-19 00:27

    If you have any other versions of Python installed, it may be that another Python version is the default Python. Could this be the case? I believe the default Python installation is determined from a registry setting.

    0 讨论(0)
提交回复
热议问题