Training Missions

Missions: Using pip and virtualenv

Removing packages and deactivating virtualenvs

Deactivating virtualenvs

To deactivate a virtualenv, simply type deactivate at the terminal and press Enter.

You'll notice that after running the deactivate command, your terminal prompt (something like C:\Users\username> on Windows or user@hostname:~ $ on Linux/Mac OS X) will no longer be prefixed by the name of a virtualenv. This means that no virtualenv is active at the moment.

To activate a virtualenv, at the terminal, type workon, followed by the name of the virtualenv that you'd like to work on like so:

workon TestEnv

Go ahead and run the above command to activate the virtualenv TestEnv that we created earlier before moving on to the next section about removing packages.

Removing packages

To uninstall a package, type pip uninstall followed by the name of the package that you'd like to remove.

Now, let's uninstall the Requests library that we installed earlier. At the terminal, type the following command and press Enter:

pip uninstall requests

After Requests has been removed successfully, type pip list at the terminal and press Enter. Just like the pip freeze command, the pip list command also lists all Python packages installed in our environment. The most significant difference between the two commands is how they format their output. You can learn more about the subtle differences between the pip list and pip freeze commands here.

To complete this part of the mission, select the output of the pip list command with your mouse and use your terminal program's copy-paste functionality to copy it to the clipboard. Paste it into the form below. Then, submit!

Paste the output of the pip list command here: