How to remove all packages installed by pip

Erdal TAŞKESENErdal TAŞKESEN
1 min read

Sometimes you want to get rid of 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 which includes the python executable, base libraries, etc.

virtualenv --clear __Your_Env_Name__

You should always back up the pip list before clearing all packages.

References

  1. https://pip.pypa.io/en/stable/cli/

  2. https://virtualenv.pypa.io/en/latest/cli_interface.html#section-creator

0
Subscribe to my newsletter

Read articles from Erdal TAŞKESEN directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Erdal TAŞKESEN
Erdal TAŞKESEN

Hey, y’all 🖖🏽 I am a passionate self-taught developer, open-source advocate, and tech enthusiast with a hands-on approach to problem-solving and an unending thirst for knowledge. Anything and everything classified as technology fascinate me.