Installing Third-Party Packages Securely with pip
Intuitive Python — by David Muller (36 / 41)
👈 Chapter 5 Standing Guard When Python Breaks Free | TOC | Maintaining Privacy in a Public World 👉
Python’s built-in third-party package manager is called pip. pip allows you to download third-party Python packages from the internet and use them in your programs. In this section you’ll learn how to mitigate some of the dangers inherent to pip as you use it to download packages.
Running pip
You can try running pip by executing the following:
<= python3 -m pip --version
If you run this command, you should see output roughly like the following:
<= pip 20.2.3 from /home/monty/code/my-virtual-env/lib/python3.9/site-packa
ges/pip (python 3.9)
Your output may be slightly different if, for example, you are using a different version of Python, pip, or have Python installed in a different location. That’s OK — our goal here is just to verify that you can run pip.
The -m Flag
INFORMATION
The -m flag in the python3 -m pip — version command instructs Python to run the pip module (emphasis on “m”). While you can omit the leading python3 -m and just say pip — version to invoke pip, the python3 -m invocation style makes it clear exactly which python executable you want to run pip with…