How to install pip with Python 3?
Solution 1
edit: Manual installation and use of setuptools
is not the standard process anymore.
If you're running Python 2.7.9+ or Python 3.4+
Congrats, you should already have pip
installed. If you do not, read onward.
If you're running a Unix-like System
You can usually install the package for pip
through your package manager if your version of Python is older than 2.7.9 or 3.4, or if your system did not include it for whatever reason.
Instructions for some of the more common distros follow.
Installing on Debian (Wheezy and newer) and Ubuntu (Trusty Tahr and newer) for Python 2.x
Run the following command from a terminal:
sudo apt-get install python-pip
Installing on Debian (Wheezy and newer) and Ubuntu (Trusty Tahr and newer) for Python 3.x
Run the following command from a terminal:
sudo apt-get install python3-pip
Note:
On a fresh Debian/Ubuntu install, the package may not be found until you do:
sudo apt-get update
Installing pip
on CentOS 7 for Python 2.x
On CentOS 7, you have to install setup tools first, and then use that to install pip
, as there is no direct package for it.
sudo yum install python-setuptools
sudo easy_install pip
Installing pip
on CentOS 7 for Python 3.x
Assuming you installed Python 3.4 from EPEL, you can install Python 3's setup tools and use it to install pip
.
# First command requires you to have enabled EPEL for CentOS7
sudo yum install python34-setuptools
sudo easy_install pip
If your Unix/Linux distro doesn't have it in package repos
Install using the manual way detailed below.
The manual way
If you want to do it the manual way, the now-recommended method is to install using the get-pip.py
script from pip
's installation instructions.
Install pip
To install pip, securely download
get-pip.py
Then run the following (which may require administrator access):
python get-pip.py
If
setuptools
is not already installed,get-pip.py
will install setuptools for you.
Solution 2
I was able to install pip for python 3 on Ubuntu just by running sudo apt-get install python3-pip
.
Solution 3
Python 3.4+ and Python 2.7.9+
Good news! Python 3.4 (released March 2014) ships with Pip. This is the best feature of any Python release. It makes the community's wealth of libraries accessible to everyone. Newbies are no longer excluded by the prohibitive difficulty of setup. In shipping with a package manager, Python joins Ruby, Nodejs, Haskell, Perl, Go--almost every other contemporary language with a majority open-source community. Thank you Python.
Of course, that doesn't mean Python packaging is problem solved. The experience remains frustrating. I discuss this at Does Python have a package/module management system?
Alas for everyone using an earlier Python. Manual instructions follow.
Python ≤ 2.7.8 and Python ≤ 3.3
Follow my detailed instructions at https://stackoverflow.com/a/12476379/284795 . Essentially
Official instructions
Per https://pip.pypa.io/en/stable/installing.html
Download get-pip.py
, being careful to save it as a .py
file rather than .txt
. Then, run it from the command prompt.
python get-pip.py
You possibly need an administrator command prompt to do this. Follow http://technet.microsoft.com/en-us/library/cc947813(v=ws.10).aspx
For me, this installed Pip at C:\Python27\Scripts\pip.exe
. Find pip.exe
on your computer, then add its folder (eg. C:\Python27\Scripts
) to your path (Start / Edit environment variables). Now you should be able to run pip
from the command line. Try installing a package:
pip install httpie
There you go (hopefully)!
Solution 4
if you're using python 3.4+
just type:
python3 -m pip
Solution 5
For Ubuntu 12.04 or older,
sudo apt-get install python3-pip
won't work. Instead, use:
sudo apt-get install python3-setuptools ca-certificates
sudo easy_install3 pip
deamon
Updated on July 08, 2022Comments
-
deamon almost 2 years
I want to install pip. It should support Python 3, but it requires setuptools, which is available only for Python 2.
How can I install pip with Python 3?
-
talljosh about 12 yearsIt's worth noting that the distribute install script has a
--user
flag that will install distribute just for the current user. -
yoniLavi over 11 yearsThen use
pip-3.2 install
(replace 3.2 with your version) to install the packages - also see stackoverflow.com/questions/10763440/… -
Tyler Crompton about 11 yearsHow does one use distribute to install pip? I can't seem to figure it out.
-
wkl about 11 years@TylerCrompton -
easy_install pip
. -
Jonathan Hartley about 11 yearsI ran "python3.3 distribute_setup.py". It seemed to work but the only easy_install on my PATH now are "easy_install" in Python2.7, plus "easy_install-2.6 easy_install-3.2 easy_install-2.5 easy_install-2.7" :-\
-
Dennis about 11 years
Unable to locate package python3-pip
. Has it been renamed? -
Anonymous Coward almost 11 yearsAre you using Ubuntu 12.04 LTS? It's not available there.
-
MCP almost 11 yearsI think I've read about easy_install being depreciated due to insecure connections. I'd read up before using easy_install.
-
wegry almost 11 yearsdistribute has since been superseded by [setup_tools] (pypi.python.org/pypi/setuptools).
-
ehime over 10 years+1 Confirmed working on ubuntu 13.04 after
sudo apt-get install -y python3.3
and usingtype pip3
-
Admin almost 10 yearsAfter python get-pip.py, I also make a symlink from pip3 in /Library/Frameworks/Python.framework/Versions/3.3/bin (for example) to my system PATH, to make pip3 available on command line.
-
lfx_cool almost 10 yearsBy default, the commands pipX and pipX.Y will be installed on all platforms (where X.Y stands for the version of the Python installation), along with the pip Python package and its dependencies.
-
treesAreEverywhere over 9 yearsI just installed python 3.4.1 from scratch on windows 8. Where is pip? How can i start it?
-
Rob Agar over 9 yearsUbuntu 14.04, just did
apt-get install python3-dev
, python 3.4 installed, no pip :( -
newguy over 9 yearsI can install pip3.4 with Python 3.4 on CentOS 6.5. But I used the same method and failed to install pip3.4 on CentOS 7. Python3.4 is OK though.
-
João dos Reis over 9 years@treesAreEverywhere it'll be in your Python installation. Add the Python bin folder to your path.
-
WoJ over 9 yearsFrom pythonhosted.org/distribute: "Distribute is a deprecated fork of the Setuptools project.". It is abandoned and not being maintained anymore.
-
WoJ over 9 yearsThe version I just installed (
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
) does not havepip
anywhere. -
William Patton about 9 yearsI also just ran this on RPi and used it with
sudo pip-3.2 install [packageName]
-
abarnert about 9 yearsThis is not true: "And, alas for everyone using an earlier Python. There's no plan to ship Pip to you."
pip
is shipped with 2.7.9+ as well as 3.4.0+. Of course that doesn't help people on 2.6 or 3.2, but the majority of people who need to use an earlier Python than 3.4 need to use 2.7. -
james-see over 8 yearsFor some reason on my instance of Ubuntu 14.04 with python3.4 already installed from apt-get, I also had to run
sudo easy_install3 pip
and thenpip3 install
works from that point on. -
hamx0r over 8 yearsThis helped until the
mkvirtualenv py3
line - on OS X El Capitan, i get acommand not found
error. Also, to actually use python 3 after using brew to install it, i have to runpython3
rather than justpython
which still maps to python 2.7. are there different steps for El Capitan? -
silverdagger over 8 years@hamx0r you would run python3 or you could symlink it:
-
Water over 8 yearspip3 was not installed when I installed Python 3.4, I had to follow instructions here to get it.
-
mahacoder over 8 yearsI installed pip the manual way , but now I have pip and pip3 both. If I run any of them with
-V
option, I getpip 8.0.2 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (python 3.5)
. How do I keep only one and remove the other? -
tamale about 8 yearspip is unfortunately not included with python 3.4 if you're on centos. See here for details: stackoverflow.com/questions/32618686/…
-
wkl about 8 years@ak31 -
pip
is likely a symbolic link topip3
. If you do anls -l $(which pip)
, it should probably show that. -
wkl about 8 years@tamale - Python 3.4 isn't a default package on CentOS 7 - I've included some additional instructions for people running CentOS 7, assuming they use EPEL to install Python 3.4.
-
Admin about 8 yearsPip's website says that it already comes with Python 3.4+ if you downloaded from python.org. However, when I type pip on terminal, I get command not found. So I decided to go through the python3's install docs again, where it mentions that python and pip should be accessed using the commands python3 and pip3 instead. This is not obvious from the documentation on either site.
-
Antwane about 8 yearsThank you, this command pointed my mistake: I built python 3.5 without libssl-dev package, so PIP was not built
-
zalpha314 about 8 yearsAfter you install python3-pip, if the package cannot be found, try
python3 -m pip
-
Mona Jalal almost 8 yearsImportError: No module named 'pip' after I did all these for python3.4.1 from source off the original python website!
Python 3.4.1 (default, Aug 4 2016, 16:56:02) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
-
Xaser over 7 yearsseems to be just pip3 now
-
PlasmaBinturong over 7 yearsFor those who want to use the manual install (
get-pip.py
), this won't work with python3.0 to 3.2... -
Karmavil over 7 yearsThabk you! @yoniLavi and thanks for the link also. Lot of people saying virtualenv/..wrapper but these tools are installed via pip.. So for those who doesn't know (like me) if it's irrelevant the way you install pip we've got here an obvious question. I will use pip3 by now thank you
-
not2qubit about 7 yearsThis also worked on cygwin! First update:
pip2 install --upgrade pip
andapt-cyg install python3
. Then what you wrote and you've gotpip3
. -
user25 about 7 yearswhere is windows? I don't say that I'm using only windows, I have no problem to install all of this in ubuntu, by author didn't mention linux, why there such a discrimination, like python, pip doesn't exist for windows...
-
loretoparisi about 7 yearsThis will install pip for
python
not forpython3
, the right way issudo apt-get install python3-pip
-
3pitt over 6 yearspip3 is works, but I had to use sudo pip3 install (for pandas at least)
-
CodeFinity over 6 years@loretoparisi That's what it says in the Answer up there. M Installing it now... :|
-
CodeFinity over 6 yearsI did have to follow @jamescampbell tip to get it to work fully though.
-
CodeFinity over 6 years
Collecting pip Using cached pip-9.0.1-py2.py3-none-any.whl Installing collected packages: pip Successfully installed pip-8.1.1 You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
This is bit strange...I'm fine with v8, I guess, but it always keeps saying the same message when I try to 'upgrade.' :| -
turiyag about 6 yearsOn CentOS:6 docker image: python3 -m pip /usr/bin/python3: No module named pip
-
will almost 6 yearsIt is a bit confusing. I can report that the Debian command worked for Ubuntu 16 and Python3:
sudo apt-get install python3-pip
.pip
was NOT installed withPython 3
for this Ubuntu's PPA. I used to use Python a lot -- There's really no need for a disregard for forward migration ... Yet it still happens. Some kind of interface management or poly-fill approach would save lots of trouble. Witness 17 x answers to the same question and more than a dozen comments on the accepted answer. Me thinks a smell. -
j3ffyang almost 6 yearswget bootstrap.pypa.io/get-pip.py && python get-pip.py This works for me and upgrades pip3
-
Christopher Hunter over 5 yearsOf all these methods, this is the only way I managed to get pip to install for python3.5 when I have both 3.4 and 3.5 on the system.
-
MaxiReglisse about 5 yearsthat did the trick for me, for portalocker: python3 -m pip install portalocker
-
Nicholas Leader almost 5 yearsYou can also do this in PowerShell of course. Also the '-32' refers to the 32bit version of Python. So for me the path was .\Python37\scripts\ as I was targeting the 64bit version of Python.
-
Mark Amery over 4 yearsThis doesn't answer the question asked, which was about how to install pip, not how to install stuff with pip.
-
None over 4 yearscan't thank you enough. managing per version install/uninstall is a nightmare no longer.
-
aysebilgegunduz almost 4 yearsThe best way to avoid this kind of problem is using
pyenv
. I tried this solution without usingpyenv
it didn't solve theTLS
problem. -
MayTheSForceBeWithYou almost 3 yearsDon't forget to use "python3" anywhere you see a command solution that uses "python ..." if your alias is set up to use python3 instead of python. Didn't click for me for a good couple hours
-
Vasiliki almost 3 yearsCorrect me if I am wrong but believe it's the same for Centos and amazon linux ,
sudo yum install python3-pip