Installing Python packages with pip
You now know how to define your project's dependencies in a setup.py
script. But how do you install those dependencies? How do you upgrade a dependency or replace it when you find a better one? How do you decide when it is safe to delete a dependency you no longer need? Managing project dependencies is a tricky business. Luckily, Python comes with a tool called pip that can help, especially in the early stages of your project.
The initial 1.0 release of pip
arrived on April 4, 2011, around the same time that
Node.js and npm
were taking off. Before it became pip
, the tool was named pyinstall
. pyinstall
was created in 2008 as an alternative to easy_install
, which came bundled with setuptools
at the time. easy_install
is now deprecated and setuptools
recommends using pip
instead.
Since pip
is included with the Python installer and you can have multiple versions of Python installed on your system (for example, 2.7 and 3.8), it helps to know...