I have a pip requirements file that changes during development.
Can pip
be made to uninstall packages that do not appear in the requirement
It's not a feature of pip
, no. If you really want such a thing, you could write a script to compare the output of pip freeze
with your requirements.txt
, but it would likely be more hassle than it's worth.
Using virtualenv, it is easier and more reliable to just create a clean environment and (re)install from requirements.txt
, like:
deactivate
rm -rf venv/
virtualenv venv/
source venv/bin/activate
pip install -r requirements.txt