virtualenvwrapper on Windows
suggest changeThe best practice is to separate those project environments. To create a separate Python virtual environment, follow the steps below:
Step 1: Install pip with this command: python -m pip install -U pip
Step 2: Then install “virtualenvwrapper-win” with this command. These scripts run in the regular command prompt. They do not run in PowerShell:
pip install virtualenvwrapper-win
Step 3: Create a new virtualenv environment by using command: mkvirtualenv python_3.5
The name python_3.5 does not select a Python version. mkvirtualenv also activates the new environment. These commands were not run.
Step 4: Activate the environment by using command:
workon <environment name>
Main commands for virtualenvwrapper:
mkvirtualenv <name>
Create a new virtualenv environment named <name>. The environment will be created in WORKON_HOME.
lsvirtualenv
List all of the environments stored in WORKON_HOME.
rmvirtualenv <name>
Remove the environment <name>. Uses folder_delete.bat.
workon [<name>]
If <name> is specified, activate the environment named <name> (change the working virtualenv to <name>). If a project directory has been defined, we will change into it. If no argument is specified, list the available environments. One can pass additional option -c after virtualenv name to cd to virtualenv directory if no projectdir is set.
deactivate
Deactivate the working virtualenv and switch back to the default system Python.
add2virtualenv <full or relative path>
If a virtualenv environment is active, appends <path> to virtualenv_path_extensions.pth inside the environment’s site-packages, which effectively adds <path> to the environment’s PYTHONPATH. If a virtualenv environment is not active, appends <path> to virtualenv_path_extensions.pth inside the default Python’s site-packages. If <path> doesn’t exist, it will be created.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents