How to remove all packages installed by pip

29 March 2018

Sometimes you want to get rid of from all python packages. There is a quick and easy way to do this. The command below will also remove the packages installed via VCS.

pip freeze | grep -v "^-e" | xargs pip uninstall -y

You may also use the command below. The command will also remake virtualenv, including copying python executable, install base libraries and etc.

virtualenv --clear __Your_Env_Name__

You should always backup pip list before clearing all packages.

Tags: python pip virtualenv