The output includes the name, version, and a brief
description of what the package does.
To install a specific version of a package, you can specify
a version number or a minimum version so that you can
get recent bug fixes:
Click here to view code image
pip install package==1.1.1. To install a specific
version
pip install package>=1.0 To install a version
greater than or
equal to 1.0
When you download sample code, if there are package
dependencies, there is usually a readme file that lists
these requirements.
Using a requirements.txt file included with your code is
another essential good practice. Such a file makes it
simpler to get your Python environment ready to go as
quickly as possible. If you have a requirements.txt file
included with your code, it will give pip a set of packages
that need to be installed, and you can issue this one
command to get them loaded:
Click here to view code image
pip install -r requirements.txt
The requirements.txt file is just a list that maps Python
package names to versions. Example 3-1 shows what it
looks like.
Example 3-1 Contents of requirements.txt
ansible==2.6.3
black==19.3b0
flake8==3.7.7
genie==19.0.1
ipython==6.5.0