Install pip for Python 3
17,313
Solution 1
From Python 3.4 pip
is baked into standard Python. You can use it like,
python3 -m pip install SomePackage
as mentioned in the Python Docs.
Solution 2
The guaranteed cross-platform way to run a module 'mod' with a particular python version 'pythonx' is
pythonx -m mod
On Windows, with the py launcher, I might run any of
py -2.7 -m pip
py -3.5 -m pip
py -3.6 -m pip
There is then no question which python and pip combination I will get. Other systems with one 2.x and 3.x version installed can use
python2 -m pip
python3 -m pip
Author by
Harsh Khajuria
4th year Computer Science Undergraduate at NIT Srinagar.
Updated on June 12, 2022Comments
-
Harsh Khajuria almost 2 years
When I type
python3 --version
in terminal it shows Python 3.6.0.When I type in
pip --version
it showspip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
How do I get it from
Python/2.7
toPython/3.6
?-
m0nhawk almost 7 yearsWhat about
pip3 --version
? -
Harsh Khajuria almost 7 yearspip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)
-
m0nhawk almost 7 yearsSo, you have
pip
already installed. -
Harsh Khajuria almost 7 yearsI was basically watching a Django tutorial by Derek Banas and he said that it should show Python/3.x Version when I type in pip --version
-
Harsh Khajuria almost 7 yearsSo what is going on in here?
-
m0nhawk almost 7 yearsYou just need to use
pip3
instead ofpip
for Python 3.6.0. -
Harsh Khajuria almost 7 yearsHow do you know all this stuff? Can you point me to some documentation that I can read so that I can figure this stuff by myself? Thank you.
-
narendra-choudhary almost 7 years@HarshKhajuria Either change default python version to python3 or use virtualenv. Using virtualenv is recommended way to go.
-
-
Vikram Hosakote over 5 yearsThis worked for me and I was able to install the
requests
package forpython3
by doingpython3 -m pip install requests
on Mac.