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.

Windows

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

Linux

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s