简体   繁体   中英

PyInstaller “ImportError: No module named Pyinstaller”

This is the code that gets produced when I run python configure.py.

dan@Q430-Q530:~/pyinstaller-2.0/PyInstaller$ python configure.py
Traceback (most recent call last):
  File "configure.py", line 28, in <module>
    from PyInstaller import HOMEPATH, PLATFORM
ImportError: No module named PyInstaller

So, currently, I can't even get PyInstaller running because of a missing module called... PyInstaller. This is PyInstaller 2.0, and you can find some screens of the insides of the /pyinstaller-2.0 and the /pyinstaller-2.0/PyInstaller directories here and here , respectively.

Does anyone here know what's going on? I tried copying the pyinstaller.py file in the /pyinstaller-2.0 directory into the /pyinstaller-2.0/PyInstaller directory, but I had no luck there.

This will probably turn out to be some ridiculously easy fix, but... It's got me stumped. If there's any more information needed, just ask and I shall try to provide.

With PyInstaller 2.0, you do not need to run configure or pyinstaller files. (Read PyInstaller 2.0 Document which comes with the installation files.)

To build your project; in the /your/path/to/pyinstaller/ directory, just run:

"python pyinstaller.py [opts] yourprogram.py"

I don't think the configure.py , makespec.py and build.py files are supposed to be run directly in PyInstaller 2.0.

In the download there's a pyinstaller.py file in the top level - run that.

It looks like the configure.py is expecting . to be on your PYTHONPATH . You should be able to run python in /pyinstaller-2.0 and import PyInstaller . This should fail as it does in the script. You can add . to your environment variable in your ~/.bashrc (make sure to source it or start a new terminal session to get the change). This would be something like:

export PYTHONPATH=.:$PYTHONPATH

Or, you can add to the top of the configure script:

import sys
sys.path.append('.')

Either way you should be able to run the script in /pyinstaller-2.0 and import the PyInstaller module.

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