Python Standard Libraries and Packages and Virtual Environments
Python Standard Libraries and Packages and Virtual Environments
You can also install a specific version of a package by giving the package name followed
by == and the version number:
If you re-run this command, pip will notice that the requested version is already installed and do
nothing.
You can supply a different version number to get that version, or you can run python -
m pip install --upgrade to upgrade the package to the latest version:
python -m pip uninstall followed by one or more package names will remove the packages from
the virtual environment.
python -m pip show will display information about a particular package:
python -m pip list will display all of the packages installed in the virtual environment:
python -m pip freeze will produce a similar list of the installed packages, but the output uses the
format that python -m pip install expects. A common convention is to put this list in
a requirements.txt file:
The requirements.txt can then be committed to version control and shipped as part of an
application.
Users can then install all the necessary packages with install -r: