Under Windows, python interpreter installed multiple installations and virtual environments

Quguan own website to download specific environment: https://www.python.org/

1, python2.7 installation environment:
Here Insert Picture Description
Here Insert Picture Description

(This step can be selected directly below the installation complete environment to avoid local configuration environment variables below)
Here Insert Picture Description
Here Insert Picture Description
At this point, the installation is complete! But the system still does not recognize the Python command (can not believe cmd command line: python -v try) (here you do not have a complete environment to the local)
Here Insert Picture Description
If you do not have to install the full local environment, you need to configure their own environment variable
1, variable python.exe find the location where the configuration of the system to the next path
2, to find the position where the configuration pip.exe environment variable to the system
Here Insert Picture Description
2, python3 environment to install and configure
Here Insert Picture Description
Here Insert Picture Description
the installation can be completed, where not elaborate, and python2 install the same

3, python environmental choice
due python2 and python3 executable file are python.exe, you need to python2 executable file name (python.exe) renamed to python2.exe, pip.exe delete files in the Scripts directory (due there is a pip2.exe file, so just delete the file under python27 pip.exe under the scripts directory)
and then into the environment python2 dos window running python2, run python into the environment python3

Here Insert Picture Description
4, virtual environment setup and installation

I, first install the tools for managing virtual environments

Installation environment python2

python2 -m pip install --upgrade pip (先升级pip)。
python2 -m pip install virtualenv (或者 pip2 install virtualenv ) 管理虚拟环境的包。
python2 -m pip install virtualenvwrapper-win (或者pip2 install virtualenvwrapper-win) 管理virtualenv 的包。

python3 环境下安装
python -m pip install --upgrade pip (先升级pip)。
python -m pip install virtualenv (或者 pip install virtualenv ) 管理虚拟环境的包。
python -m pip install virtualenvwrapper-win (或者pip install virtualenvwrapper-win) 管理virtualenv 的包。

WORK_HOME set the environment variable
WORKON_HOME = C: \ myFiles \ Files
add virtual environment installation location of the files
Here Insert Picture Description
below to create a virtual environment
created:
mkvirtualenv -p python2.exe [virtual environment name] (python2 virtual environment created)
mkvirtualenv -p python.exe [ virtual environment name] (python3 environment created)
delete:
rmvirtualenv [virtual environment name]
View:
workon
enter:
workon [virtual environment name]
exit: deactivate
Here Insert Picture Description
since then create a project environment you can choose when you want.

Guess you like

Origin blog.csdn.net/MZP_man/article/details/92442326