All of the commands below are to be used on the Terminal command line.
Create a new environment, in the WORKON_HOME.
mkvirtualenv [options] ENVNAME
(where the options are passed directly to virtualenv)
Remove an environment, in the WORKON_HOME.
List or change working virtual environments
If no environment_name is given the list of available environments is printed to stdout.
Switch from a virtual environment to the system-installed version of Python.
This command is actually part of virtualenv, but is wrapped to provide before and after hooks, just as workon does for activate.
Sometimes it is desirable to share installed packages that are not in the system site-pacakges directory and which you do not want to install in each virtualenv. In this case, you could symlink the source into the environment site-packages directory, but it is also easy to add extra directories to the PYTHONPATH by including them in a .pth file inside site-packages using add2virtualenv.
- Check out the source for a big project, such as Django.
- Run: add2virtualenv path_to_source.
- Run: add2virtualenv.
- A usage message and list of current "extra" paths is printed.
Adds the specified directories to the Python path for the currently-active virtualenv.
add2virtualenv directory1 directory2 ...
Path management for packages outside of the virtual env. Based on a contribution from James Bennett and Jannis Leidel.
This will be done by placing the directory names in a path file named virtualenv_path_extensions.pth inside the virtualenv's site-packages directory; if this file does not exist, it will be created first.
Calling lssitepackages shows the content of the site-packages directory of the currently-active virtualenv.