How to install python3 version of package via pip on Ubuntu?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5
--
Chapters
00:00 How To Install Python3 Version Of Package Via Pip On Ubuntu?
00:31 Accepted Answer Score 267
00:48 Answer 2 Score 42
01:07 Answer 3 Score 477
02:02 Answer 4 Score 212
03:24 Thank you
--
Full question
https://stackoverflow.com/questions/1076...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #ubuntu #python3x #ubuntu1204 #pip
#avk47
ANSWER 1
Score 477
Ubuntu 12.10+ and Fedora 13+ have a package called python3-pip which will install pip-3.2 (or pip-3.3, pip-3.4 or 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
python3-setuptools: runsudo aptitude install python3-setuptools, this will give you the commandeasy_install3. - Install pip using Python 3's setuptools: run
sudo easy_install3 pip, this will give you the commandpip-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). - …
- Profit!
ACCEPTED ANSWER
Score 267
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 py3env
source py3env/bin/activate
pip install package-name
ANSWER 3
Score 212
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.
ANSWER 4
Score 42
The easiest way to install latest pip2/pip3 and corresponding packages:
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
pip2 install package-name
curl https://bootstrap.pypa.io/get-pip.py | python3
pip3 install package-name
Note: please run these commands as root