[Switch] Use pycharm to configure the virtualenv environment of python under windows

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 
write picture description here

View the venv directory generated in the current directory

cmd>D:\virtualenv>dir 
cmd>D:\virtualenv>tree 
write picture description here

Turn on and off virtualenv

Enter the venv directory to 
activate 
cmd>D:\virtualenv\venv>Scripts\activate 
close 
(venv) D:\virtualenv\venv>deactivate 
write picture description here

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

write picture description here

Select the virtual environment you just created

write picture description here

build success, test

write picture description here

This article is reproduced to: https://blog.csdn.net/hy245120020/article/details/50776197

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324776475&siteId=291194637