Basic Examples (5)
Create a new virtual environment for the specified Python version:
The environment is registered and ready to use:
Start a new Python session in the new environment:
Evaluate code in the session:
End the session and delete the environment:
Scope (3)
Create a new virtual environment using the default Python system:
Delete the environment:
Create a new virtual environment based on another Python version:
Delete the environment:
Create a virtual environment outside the current working directory:
Delete the environment:
Applications (7)
Virtual environments are perfect for experimenting with a new system version or a new version of a complex package with multiple dependencies without affecting other Python systems. Here is a set of packages installed in the default Python instance:
Create a new virtual environment:
At the outset, the new environment has only the default package set:
Install a package with multiple dependencies:
The environment now has other packages:
The default system is not affected:
Delete the environment after the work is done:
Properties and Relations (2)
The UUID returned by CreatePythonVirtualEnvironment is a key in the dataset of external evaluators given by FindExternalEvaluators for the "Python" system:
Delete the environment:
CreatePythonVirtualEnvironment automatically creates intermediate directories:
DeletePythonVirtualEnvironment, on the other hand, deletes only the directory that contains the environment, leaving the (possibly empty) intermediate directories in place:
Delete the directories to clean up:
Possible Issues (2)
If the parent Python system is not registered, the system specification in CreatePythonVirtualEnvironment must refer to the executable file explicitly:
Specify the target:
Or the executable:
CreatePythonVirtualEnvironment is not supported with Python 2: