Missions: Using pip and virtualenv
More about pip and virtualenv
More about virtualenv and virtualenvwrapper
Deleting a virtualenv is as simple as creating one. To delete a virtualenv, at the terminal, type rmvirtualenv followed by the name of the virtualenv that you'd like to remove, like so:
The above command will delete the virtualenv TestEnv, that we created earlier.
Another useful command is lsvirtualenv, which lists all of the virtual environments that we have created so far.
For a full list of virtualenvwrapper commands, go here.
More about pip
You can also use pip to search the Python Package Index (PyPI) for packages. For instance, to search for a package that allows you to work with HTTP, type,
pip search http
or maybe, to search for packages related to matplotlib, a Python 2D plotting library, type:
pip search matplotlib
If you find yourself installing the same package frequently in virtualenvs, it quickly becomes a pain to wait for pip to download the package again on every separate install. The pip wheel command can be used here. Here's the syntax:
pip wheel foo pip install foo
where foo is the name of the package to install.
The pip wheel command above downloads the package foo from PyPI and keeps it in a special directory of its own. After that, whenever you try and install the same package foo, pip will skip the downloading phase and install it using the the file saved by pip wheel.
This may not seem like a big deal for small packages, but for large packages like matplotlib, which is roughly 48 megabytes in size, pip wheel can save you a lot of time.
You can learn more about pip here.