I have a pip requirements file that changes during development.
Can pip be made to uninstall packages that do not appear in the requirement
pip
Here's a simple solution that works:
pip uninstall $(pip freeze) -y