What is the easiest way to remove all packages installed by pip?
Question:
I want to revert my Python install back to its base state so I can start using virtualenv
. Is there an easy way to uninstall only those packages that have been installed after Python was set up?
Answers:
The following command should do the trick:
pip freeze > requirements.txt && pip uninstall -r requirements.txt -y
Alternatively you can skip the creation of any intermediate files (i.e. requirements.txt
):
pip uninstall -y -r <(pip freeze)
do following
-
store all the pip packages in requirements.txt
python -m pip freeze > requirements.txt
-
remove all pip packages which menetioned in requirements.txt
python -m pip uninstall -r requirements.txt
I want to revert my Python install back to its base state so I can start using virtualenv
. Is there an easy way to uninstall only those packages that have been installed after Python was set up?
The following command should do the trick:
pip freeze > requirements.txt && pip uninstall -r requirements.txt -y
Alternatively you can skip the creation of any intermediate files (i.e. requirements.txt
):
pip uninstall -y -r <(pip freeze)
do following
-
store all the pip packages in requirements.txt
python -m pip freeze > requirements.txt
-
remove all pip packages which menetioned in requirements.txt
python -m pip uninstall -r requirements.txt