Reputation: 3923
In Ubuntu I have Python3 as default and pip and pip3. Now I need Python2 to install an app. I have Python2 installed but not pip2. If I try
sudo python2 -m pip install my_app
or
sudo python2 -m pip2 install my_app
I get:
No module named pip
If I install pip2 via easy_install or get-pip.py will it make me problems with pip which is for Python3? What is the right way?
Upvotes: 0
Views: 1290
Reputation: 6506
You can safely install pip
for both py2.x and py3.x simultaneously. You can explicitly specify which pip to use by using pip2
for py2.x or pip3
for py3.x.
sudo apt-get install python-pip
installs pip2
while
sudo apt-get install python3-pip
installs pip3
also to keep things simple, just using
sudo pip2 install my_app
will suffice.
EDIT:
I have noticed that in some cases even pip3
calls the python2.x interpreter. To be on a totally safe side I recommend using -
sudo python2 -m pip install my_app
for python2.x and
sudo python3 -m pip install my_app
for python3.x
Upvotes: 3
Reputation: 307
sudo apt-get install python-pip
Is a right command to my knowledge. Bit I don't think the other methods will interrupt your python3 but no experience with those.
Upvotes: 0