How to install python3 version of package via pip on Ubuntu?
Ubuntu 12.10+ and Fedora 13+ have a package called
python3-pip which will install
pip3 for newer versions) without needing this jumping through hoops.
I came across this and fixed this without needing the likes of
wget or virtualenvs (assuming Ubuntu 12.04):
- Install package
sudo aptitude install python3-setuptools, this will give you the command
- Install pip using Python 3's setuptools: run
sudo easy_install3 pip, this will give you the command
pip-3.2like kev's solution.
- Install your PyPI packages: run
sudo pip-3.2 install <package>(installing python packages into your base system requires root, of course).
You may want to build a
virtualenv of python3, then install packages of python3 after activating the virtualenv. So your system won't be messed up :)
This could be something like:
virtualenv -p /usr/bin/python3 py3envsource py3env/bin/activatepip install package-name
sudo apt-get install python3-pipsudo pip3 install MODULE_NAME
Source: Shashank Bharadwaj's comment
The short answer applies only on newer systems. On some versions of Ubuntu the command is
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 curlcurl https://bootstrap.pypa.io/get-pip.py | sudo python3sudo pip3 install MODULE_NAME
If you don't have
wget. If you don't have
sudo, switch to
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
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.