There are two ways to create virtual environment using virtualenv under Windows: of
- 2021-07-09 09:30:28
- OfStack
Operating system: windowns10_x64
Python version: 3.6. 8
virtualenv version: 16.7.7
virtualenvwrapper version: 1.2. 5
Mode 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
If you need to delete the virtual environment, you can delete py36env directly.
Mode 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 related folder will be 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 the virtual environment
lsvirtualenv
workon py36env
5. Exit the virtual environment
deactivate
If you need to remove the virtual environment, execute the following command:
rmvirtualenv py36env
github address in this article:
Use of virtualenv under https://github.com/mike-zhang/mikeBlogEssays/blob/master/2019/20191026 _ windows. rst
Summarize
The above is the site to introduce you under the Windows virtualenv to create a virtual environment, I hope to help you!