How to create a virtual environment using virtualenv under Windows (two ways)
Operating system: windowns10_x64
Python version: 3.6.8
Virtualenv version: 16.7.7
Virtualenvwrapper version: 1.2.5
Method 1: use virtualenv directly
1. Installation
Pip install virtualenv
2. Create a virtual environment
Virtualenv-p d:/app/Python36/python.exe py36env
3. Start the virtual environment
Py36env\ Scripts\ activate.bat
4. Exit the virtual environment
Deactivate
Delete the py36env directly if you need to delete the virtual environment.
Method 2: use virtualenvwrapper
1. Installation
Pip install virtualenvwrapper-win
2. Set the environment variable WORKON_HOME to specify the default path of virtualenvwrapper virtual environment
For example, set it to c:\ venv and create the venv directory.
If it is not set, the relevant folder is automatically created in the current user directory.
3. Create a virtual environment
Mkvirtualenv py36env-p d:/app/Python36/python.exe
4. View all virtual environments and start virtual environments
Lsvirtualenv
Workon py36env
5. Exit the virtual environment
Deactivate
If you need to delete the virtual environment, execute the following command:
Rmvirtualenv py36env
The github address of this article:
Virtualenv uses .rst under https://github.com/mike-zhang/mikeBlogEssays/blob/master/2019/20191026_windows
Summary
The above is the editor to introduce to you the way to create a virtual environment using virtualenv under Windows, I hope it will be helpful to you!