Cleanup the default Python environment

I have been messing around with Python these last few weeks. Playing with Python means installing a lot of packages. I did this without using virtualenv, so my default Python environment had a lot of packages installed globally.

I now have a couple of projects that I want to work on and I what each project to have its own clean environment. That means using virtualenv. When running virtualenv without with the option --no-site-packages all the packages that are installed globally are included in the virtualenv.

I wanted to remove all the global packages to have a clean default environment. I did this by running the following command.


pip freeze > remove.txt && pip uninstall -y -r remove.txt && del remove.txt


pip freeze > remove.txt && pip uninstall -y -r remove.txt && rm remove.txt

After cleaning up the default envrionment by removing all the global packages don’t forget to install virtualenv en virtualenvwrapper-win by running the following command.

pip install virtualenvwrapper-win

For quick instructions of the main commands please check out virtualenvwrapper-win Github page.

Leave a Reply

Your email address will not be published. Required fields are marked *