Pyinstaller doesn't work on Linux

Solved
DD -  
mamiemando Posted messages 33541 Registration date   Status Modérateur Last intervention   -
Good evening,
Look at what gets displayed when I try to install pyinstaller:

salim@helium:~$ pip3 install pyinstaller
Looking in indexes: https://pypi.org/simple https://www.piwheels.org/simple
Requirement already satisfied: pyinstaller in ./.local/lib/python3.7/site-packages (5.0.dev0)
Requirement already satisfied: altgraph in ./.local/lib/python3.7/site-packages (from pyinstaller) (0.17.2)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in ./.local/lib/python3.7/site-packages (from pyinstaller) (4.8.2)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from pyinstaller) (40.8.0)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in ./.local/lib/python3.7/site-packages (from pyinstaller) (2022.0)
Requirement already satisfied: zipp>=0.5 in ./.local/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->pyinstaller) (3.6.0)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in ./.local/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->pyinstaller) (4.0.0)
salim@helium:~$ pyinstaller brouillon2.py
bash: pyinstaller: command not found

Do you have a solution?

1 réponse

mamiemando Posted messages 33541 Registration date   Status Modérateur Last intervention   7 935
 
Hello,

To find a command, your shell searches in order the directories referenced in the environment variable
PATH
which you can display with the command:

echo $PATH


Example :

(mando@silk) (~) $ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games


All these directories require administrative privileges (for obvious security reasons) to add other executables. Since you run
pip3
without
sudo
,
pip3
does not have the rights to install
pyinstaller
in
/usr/local/bin
(which would be the directory where the executable would be installed if you used
sudo pip3 install pyinstaller
). It probably deploys it in something like
~/.local/bin
where
~
represents your home directory (e.g.
/home/toto
). If this directory is not in your
PATH
, your shell cannot find this executable because it will not look in that directory.

Solution 1: install pyinstaller as root

sudo pip3 install pyinstaller which pyinstaller


Here is what it looks like on my end:

(mando@silk) (~) $ which pyinstaller 
/usr/local/bin/pyinstaller


Solution 2: add ~/.local/bin to your PATH

PATH=$PATH:$HOME/.local/bin which pyinstaller


You can add at the end of the
~/.bashrc
file the directive to automatically correct your
PATH
the next time you launch a shell:

export PATH=$PATH:$HOME/.local/bin


Good luck!
0