By: @saurabhshri
Many users when are given server access, do not have root (or sudo) privileges and can not simply do
sudo apt-get install python-pip
.
Here's an easy way you can install and use pip without root (or sudo) access in a local directory.
Note : This works without easy_install
too.
- Download pip from an online repository :
wget https://bootstrap.pypa.io/get-pip.py
- Install the downloaded package into a local directory :
python get-pip.py --user
This will install pip to your local directory(.local/bin)
. - Now you may navigate to this directory
(cd .local/bin)
and then usepip
or better set your $PATH variable this directory to usepip
anywhere :PATH=$PATH:~/.local/bin
followed bysource ~/.bashrc
to apply the changes.
And that's it. You may now install all python modules you require via pip in a local directory without root.
wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py --user
cd .local/bin
./pip install <package_name> --user
@greggman you can, probably even should, be using virtualenv. You create one env per project, and then install packages to that env. --local will, AFAIK, still work too.