DEV Community

Cover image for pip stuff you might need to know
icncsx
icncsx

Posted on

pip stuff you might need to know

PIP

pip is the standard package manager for Python. It allows you to install and manage additional packages that are not part of the Python standard library. The concept of a package manager might be familiar to you if you are coming from other languages. For example, JavaScript uses npm for package management.

pip3 vs pip

pip is also the CLI command that you will use to interact with pip, and there are many variants.

> pip install pandas
> pip2 install pandas
> pip3 install pandas
Enter fullscreen mode Exit fullscreen mode

The thing to note here is that pip3 operates on a Python3 environment only, as pip2 does with Python2. pip (w/o the 2 or 3) operates contextually. For example, if you are in a Python3 virtual environment, pip will operate on the Python3 environment.

But pip3 can mean many things - like if I have Python3.7 and Python3.8?

Yes that's correct. Let's say I have two versions of Python installed, like Python 3.7 and 3.8. Now, if you were to type pip or pip3 in your terminal, it's not very clear which Python interpreter gets involved.

And this is why you'll see many developers use python -m pip. python -m pip executes pip using the Python interpreter you specified as python. Here you can provide the full path to the interpreter like: /usr/bin/python3.7 -m pip instead of relying on an alias.

Top comments (0)