This paper describes the windows
environment, how to create python2
and python3
virtual working environment. First you need to install on your computer python2
as well python3
. I installed python27
and python36
. And environment variables default configuration is python36
.
Install virtual components
Next, you need to install virtualenv
or windows
under virtualenvwrapper
which a package is on the former, more convenient to use.
windows
You can use the following command at
pip install virtualenvwrapper-win
linux
You can use the following command at
pip install virtualenv
Create a virtual machine environment
By default, in windows
, you can create a virtual machine environment using the following command:
mkvirtualenv test
linux
Under the direct use:
virtualenv test
It should be noted that the above command when you create a virtual machine environment, based on the current environment, the default is
python
to create a version, that is, if the current environment is to use the defaultpython3
, create a virtual environment, the defaultpython
version will bepython3
.
Create a virtual environment based on python version
When you create a virtual environment, you need to specify python
the program location, such as windows
under:
mkvirtualenv -p d:\app\Python27\python.exe test
Similarly, in the linux
case:
virtualenv -p /xx/xx/python test
Enter the virtual environment
In the windows
case, use the following command to enter the virtual environment:
workon test
Note that in the windows
environment, the virtual environment is installed in the default C:/用户/xxx/Envs
directory, that user space.
Exit the virtual environment:
deactivate
To delete a virtual environment:
rmvirtualenv test
Reproduced in: https: //www.jianshu.com/p/92bee56d3a12