I have both python2.7
and python3.2
installed in Ubuntu 12.04
.
The symbolic link python
links to python2.7
.
When I type:
sudo pip install package-name
It will default install python2
version of package-name
.
Some package supports both python2
and python3
.
How to install python3
version of package-name
via pip
?
How do I Install a Specific Version of a Python Package? To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .
Note: On some systems where both Python 2 & Python 3 are installed, pip and pip3 will do different things. pip installs the Python 2 version of the package, and pip3 will install the Python 3 version of the package. it should install all the modules listed on the file.
The current version of pip works on: Windows, Linux and MacOS. CPython 3.7, 3.8, 3.9, 3.10 and latest PyPy3.
Their Python distros don't include pip by default.
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):
python3-setuptools
: run sudo aptitude install python3-setuptools
, this will give you the command easy_install3
.sudo easy_install3 pip
, this will give you the command pip-3.2
like kev's solution.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 py3env source py3env/bin/activate pip install package-name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With