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?
Single Python in system
To install packages in Python always follow these steps:
python 2.x
: sudo python -m pip install [package]
python 3.x
: sudo python3 -m pip install [package]
Note: This is assuming no alias is set for python
Through this method, there will be no confusion regarding which python version is receiving the package.
Multiple Pythons
Say you have python3 ↔ python3.6
and python3.7 ↔ python3.7
sudo python3 -m pip install [package]
sudo python3.7 -m pip install [package]
This is essentially the same method as shown previously.
Note 1
How to find which python, your python3
command spawns:
ganesh@Ganesh:~$ python3 # Type in terminal
Python 3.6.6 (default, Sep 12 2018, 18:26:19) # Your python3 version
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Notice python 3.6.6 in the second line.
Note 2
Change what python3
or python
points to: https://askubuntu.com/questions/320996/how-to-make-python-program-command-execute-python-3