Short Answer
sudo apt-get install python3-pip
sudo pip3 install MODULE_NAME
Source: Shashank Bharadwaj's comment
Long Answer
The short answer applies only on newer systems. On some versions of Ubuntu the command is pip-3.2
:
sudo pip-3.2 install MODULE_NAME
If it doesn't work, this method should work for any Linux distro and supported version:
sudo apt-get install curl
curl https://bootstrap.pypa.io/get-pip.py | sudo python3
sudo pip3 install MODULE_NAME
If you don't have curl
, use wget
. If you don't have sudo
, switch to root
. If pip3
symlink does not exists, check for something like pip-3.X
Much python packages require also the dev package, so install it too:
sudo apt-get install python3-dev
Sources:
python installing packages with pip
Pip latest install
Check also Tobu's answer if you want an even more upgraded version of Python.
I want to add that using a virtual environment is usually the preferred way to develop a python application, so @felixyan answer is probably the best in an ideal world. But if you really want to install that package globally, or if need to test / use it frequently without activating a virtual environment, I suppose installing it as a global package is the way to go.
pip-2.7
andpip-3.2
commands in your system? – Lump/usr/bin/pip
from#!/usr/bin/python
to#!/usr/bin/python3
? – Munguiacp
thepip
topip-3.2
then change it, so you would get a better choice next time :) – Lumpwhereis pip
from your command line. It seems they have changed the names to pip2.7 on Ubuntu 14.04. – Anannapip3 install package-name
instead. It should be available by default nowadays. Check akaIDIOT's answer below for more details. – Reitz