Search code examples
pythonpip

How can I use a pip requirements file to uninstall as well as install packages?


I have a pip requirements file that changes during development.

Can pip be made to uninstall packages that do not appear in the requirements file as well as installing those that do appear? Is there a standard method?

This would allow the pip requirements file to be the canonical list of packages - an 'if and only if' approach.

Update: I suggested it as a new feature at https://github.com/pypa/pip/issues/716


Solution

  • The short answer is no, you can't do that with pip.