Reputation: 363
I am using Ubuntu on VirtualBox. How do I add pyinstaller
to the PATH
?
The issue is when I say
pyinstaller file.py
it says pyinstaller command not found
It says it installed correctly, and according to other posts, I think it has, but I just can't get it to work. I ran:
pip install pyinstaller
and
pyinstaller file.py
but it won't work. I think I need to add it to the shell path so Linux knows where to find it.
pip show pyinstaller
works.
Upvotes: 24
Views: 87428
Reputation: 83
python3 -m PyInstaller file.py
worked in my case on Ubuntu 22.04 LTS.
Upvotes: 4
Reputation: 41
I know this is a bit unconventional, but I fixed this by moving my script to the place where pip installed pyinstaller and just ran the command from there: First:
pip3 show pyinstaller
Then navigate to the location of pyinstaller.exe
and finally:
$python3 pyinstaller.exe --onefile myscript.py
Worked for me.
Upvotes: 0
Reputation: 113
You could do a echo $PATH
to see the content of it, an then create a symbolic link from one of the directories listed on $PATH to the current location of your pyinstaller:
sudo ln -s ~/.local/bin/pyinstaller /usr/local/sbin/pyinstaller
On the above case, usr/local/sbin/
is the path already listed on $PATH.
Upvotes: 3
Reputation: 119
Just get root access first by running sudo -i
and then installing pyinstaller again:
pip3 install pyinstaller
Upvotes: 11
There is another way to use pyinstaller using it as a Python script.
This is how I did it, go through pyinstaller's documentation
Create a Python script named setup.py
or whatever you are comfortable with.
copy this code snippet to the setup.py:
import PyInstaller.__main__
import os
PyInstaller.__main__.run([
'name-%s%' % 'name_of_your_executable file',
'--onefile',
'--windowed',
os.path.join('/path/to/your/script/', 'your script.py'), """your script and path to the script"""
])
Make sure you have installed pyinstaller. To test it:
python3
import PyInstaller
If no errors appear then you are good to go.
Put the setup.py
in the folder of your script. Then run the setup.py
This was tested in Python3.
Upvotes: 3
Reputation: 31
Come across the same issue today. In my case, pyinstaller was sitting in ~/.local/bin
and this path was not in my PATH
environment variable.
Upvotes: 3
Reputation: 1068
You can use the following command if you do not want to create additional python file.
python -m PyInstaller myscript.py
Upvotes: 78