pip defaults to installing Python packages to a system directory (such as /usr/local/lib/python3.4). This requires root access.
--user makes pip install packages in your home directory instead, which doesn't require any special privileges.
pip defaults to installing Python packages to a system directory (such as /usr/local/lib/python3.4). This requires root access.
--user makes pip install packages in your home directory instead, which doesn't require any special privileges.
Just a warning:
According to this issue, --user is currently not valid inside a virtual env's pip, since a user location doesn't really make sense for a virtual environment.
So do not use pip install --user some_pkg inside a virtual environment, otherwise, virtual environment's pip will be confused. See this answer for more details.
Why Use `pip install --user`?
Should pip install --user install in a venv install to the global user path? - Packaging - Discussions on Python.org
pip install --user should check that the user's $PATH is correct
Avoiding the use of ``--user`` and ``.local`` for pip installations
Videos
I hope I'm right and the problem is with your PATH, try this
You can add this to your ~/.bashrc file:
PATH=$PATH:~/.local/bin
If you don't know how, you can just execute this line in a Terminal:
echo "PATH=\$PATH:~/.local/bin" >> ~/.bashrc
You can also check what's in your PATH by typing in the Terminal
echo $PATH
This may be related. How to install python from source on a remote machine without root access.
Installing Python 3.6 (works with any version per say)
Get the official download link from python.org website (example)
Download the python source release and get the folder readied for installation from source.
wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz tar zxfv Python-3.6.9.tgz find ~/inflated_location/Python-3.6.9/Python -type d | xargs chmod 0755 cd Python-3.6.9Install from source
./configure --prefix=~/inflated_location/Python-3.6.9/Python make make installExport the path variable
nano ~/.bashrc export PATH=~/inflated_folder/python/Python-3.6.9/:$PATH source ~/.bashrc
Now you have python3.6 installed for logged in user and can be invoked now using command python
Installing py packages
The easiest way that I have followed is
python -m pip install <package-name> --user
Reference