Hacker News new | ask | show | jobs
by xyrouter 2867 days ago
I am aware of that. So has been many other distributions like Debian, Ubuntu, etc.

My point was: Which command do you normally use to install packages in Python 3? pip3 or pip?

I thought it was pip3 but the article seems to imply that using the pip command to install packages in Python 3 is common too. If this is true, which distribution ships Python 3 with pip instead of pip3 for installing packages in Python 3? Does it not conflict with pip of Python 2?

3 comments

Not the parent but on Ubuntu I use:

$ python -m pip ... # Use Python 2

$ python2 -m pip ... # If you want to be sure is using Python 2

$ python3 -m pip ... # Use Python 3

$ python3 -m venv ... # Create a virtualenv with Python 3 as documented on https://docs.python.org/3/library/venv.html to "prevent any potential confusion as to which Python interpreter a virtual environment will be based on"

I know it's verbose and long to type but looks explicit to me and saved me to use the wrong version of Python several times.

If 'python' is 3, I'd expect 'pip' to be for 3, and 'pip2' for 2.
Ah! That makes a lot of sense. If Python 3 is the default, it does make sense 'pip' to be the Python 3 pip. That way 'pip' always refers to the default version.

Unfortunately in the Ubuntu and Mac world 'python' is still Python 2.7 and 'pip' refers to the Python 2 pip. Python 3 is available as 'python3' along with 'pip3'.

Yes. On Arch Linux you would use just pip. pip2 for Python 2.