简体   繁体   中英

Pyinstaller command not found (MacOS)

I've been trying to use PyInstaller on my program, scratch_1.py. The PyCharm project folder is called "idigen", which is saved in my desktop. So, I changed the director like so:

cd /Users/joelsaarinen/Desktop/idigen

then, moved on to use pyinstaller, and I get this error:

pyinstaller scratch_1.py
-bash: pyinstaller: command not found

I'm confused because when I use:

pip show pyinstaller

to verify that I have pyinstaller installed, it returns a positive result.

Is there an additional command I should be putting in when using Pyinstaller on one of my files? Might this be an issue with this specific program or the operating system in general? Thanks in advance.

This is a common problem due to the fact that you might install a different version of python and keep using an old version that is preinstalled in the machine. Here is the best solution.

First, check the version of the python that you installed . In my case, i installed python 3.5 and the machine had python2.7. If you run python on the terminal, most likely the preinstalled one is the one that will run.

Second, check the directory of your desired python version . watch -a python3 is the command to run to see your directory.

Third, set the directory as the main one to run your python commands . alias python=/usr/local/bin/python3 does the whole trick

Lastly, reinstall pip . Download the get-pip.py file and run sudo /usr/local/bin/python3 get-pip.py * I used the path to show the reason we updated the alias*

Now you can run pyinstaller without problems

pyinstaller appears to have installed correctly, but the command is not available on PATH. You need to locate where the executable was placed.`below to find executables

set | grep pyinstaller

now modify path by this

 export PATH=some_path:another_path
launchctl setenv PATH $PATH

I just downloaded the source code of pyInstaller from official website, put it where I can find it and wrote a script which launches pyinstaller.py from that folder. For some reason, pyinstaller.py is missing in the pyInstaller installation downloaded via pip .

I had the same issue on MacOS with Developer Tools 11.4 and found two ways to start pyinstaller:

alt 1: path based solution

$ pip3 show -f pyinstaller|grep pyinstaller

will find pyinstaller in a bin path:

../../../../usr/local/bin/pyinstaller
...

So you can use one of the set-the-path-or-an-alias approaches or call via fully qualified path.

alt 2: call via python module

$ pip3 show -f pyinstaller|grep __init__

will get you a hint on how pyinstaller is defined as a module:

PyInstaller/__init__.py
...

With that capitalization, it's possible to call pyinstaller as a module with the following:

$ python3 -m PyInstaller --version      
4.2

I'm using the latter now.

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