Environment: win10 python2.7.10 (64)
Configure the python environment in path
D:\Develop\Python27\Scripts
D:\Develop\Python27\
install virtualenv
cmd>pip install virtualenv
create virtualenv
Go to a folder where you want to create a virtual python environment
cmd>D:>cd virtualenv
cmd>D:\virtualenv>virtualenv venv
View the venv directory generated in the current directory
cmd>D:\virtualenv>dir
cmd>D:\virtualenv>tree
Turn on and off virtualenv
Enter the venv directory to
activate
cmd>D:\virtualenv\venv>Scripts\activate
close
(venv) D:\virtualenv\venv>deactivate
Notice
The virtual environment created by virtualenv is completely independent of the host's Python environment, and
the libraries configured by your host cannot be used directly in virtualenv.
You need to use pip install to install the configuration again in the virtual environment to use it.
How to use the configured virtualenv environment in pycharm
Open setting to add local python environment
Select the virtual environment you just created
build success, test
This article is reproduced to: https://blog.csdn.net/hy245120020/article/details/50776197