先安装的Python3.6,后安装Python2.7
创建虚拟环境
virtualenv --python=D:\Python27\python.exe venv
激活虚拟环境
D:\deeplab\deeplab-resnet-master>cd .\venv
D:\deeplab\deeplab-resnet-master\venv>.\Scripts\activate.bat
(venv) D:\deeplab\deeplab-resnet-master\venv>python
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
关闭虚拟环境:deactivate
(venv) D:\deeplab\deeplab-resnet-master\venv>deactivate
D:\deeplab\deeplab-resnet-master\venv>python
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
sky@sky-X450CC:~/python27env$ virtualenv --no-site-packages venv
New python executable in /home/sky/python27env/venv/bin/python
Installing setuptools, pip, wheel...done.
sky@sky-X450CC:~/python27env$ source ./venv/bin/activate
(venv) sky@sky-X450CC:~/python27env$ python
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(venv) sky@sky-X450CC:~/python27env$ deactivate
sky@sky-X450CC:~/python27env$
https://code.visualstudio.com/docs/python/environments
virtualenv --help
Usage: virtualenv [OPTIONS] DEST_DIR
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-v, --verbose Increase verbosity.
-q, --quiet Decrease verbosity.
-p PYTHON_EXE, --python=PYTHON_EXE
The Python interpreter to use, e.g.,
--python=python2.5 will use the python2.5 interpreter
to create the new environment. The default is the
interpreter that virtualenv was installed with
(/usr/bin/python)
--clear Clear out the non-root install and start from scratch.
--no-site-packages DEPRECATED. Retained only for backward compatibility.
Not having access to global site-packages is now the
default behavior.
--system-site-packages
Give the virtual environment access to the global
site-packages.
--always-copy Always copy files rather than symlinking.
--unzip-setuptools Unzip Setuptools when installing it.
--relocatable Make an EXISTING virtualenv environment relocatable.
This fixes up scripts and makes all .pth files
relative.
--no-setuptools Do not install setuptools in the new virtualenv.
--no-pip Do not install pip in the new virtualenv.
--no-wheel Do not install wheel in the new virtualenv.
--extra-search-dir=DIR
Directory to look for setuptools/pip distributions in.
This option can be used multiple times.
--download Download preinstalled packages from PyPI.
--no-download, --never-download
Do not download preinstalled packages from PyPI.
--prompt=PROMPT Provides an alternative prompt prefix for this
environment.
--setuptools DEPRECATED. Retained only for backward compatibility.
This option has no effect.
--distribute DEPRECATED. Retained only for backward compatibility.
This option has no effect.
virtualenv --always-copy --python=python3.5 ./py35/