Removing packages and deactivating virtualenvs

Tutorial ButtonHaving trouble with the mission? Read how to get help.

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 [email protected]:~ $ 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
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