Python PIP Commands

This is a summary of pip commands that are useful for day to day activity.

python -m pip uninstall <packagename>
python -m pip show <packagename>
python -m pip list
python -m pip freeze > requirements.txt
python -m pip install -r requirements.txt
python -m pip install --upgrade <packagename>

python -m pip list – lists the packages currently installed in the virtual environment

python -m pip freeze > requirements.txt – takes out all the packages that are required for the current software to work; on each line there is a package name and the version (with = sign in between). The list is done at the console, so you might want to redirect this to a file, for example as mentioned above, to a file called requirements.txt

python -m pip install -r requirements.txt – well, install the packages that are listed in requirements.txt. Typically this is used when the application is prepared for installation in environment. That is the reason a well curated requirements.txt file MUST be part of the deliverables.