使用virtualenv共存python2和3
2017-12-27 17:39
176 查看
Windows:
先安装的Python3.6,后安装Python2.7进入cmd
安装virtualenv
创建虚拟环境
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. >>>
Ubuntu
sky@sky-X450CC:~/python27env$ virtualenv --no-site-packages venv New python executable in /home/sky/python27env/venv/bin/python Installing setuptools, pip, wheel... b7b7 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/
相关文章推荐
- windows下使用virtualenv进行多版本python共存
- 多版本Python共存[支持使用pip安装包]
- 使用virtualenv隔离python环境
- 使用virtualenv创建虚拟python环境
- 使用virtualenv搭建python虚拟开发环境
- python - 沙盒环境 - virtualenv - 简明使用录
- python的pip和virtualenv使用心得
- python的pip和virtualenv使用心得
- [python]使用virtualenv处理python版本问题
- Windows下使用python虚拟环境Virtualenv
- Python虚拟环境Virtualenv使用教程
- 【Python学习笔记】windows上virtualenv 安装及使用
- python virtualenv的使用
- python的pip和virtualenv使用心得
- python的pip和virtualenv使用心得
- mac下使用pyenv,pyenv-virtualenv管理python的多个版本
- python的pip和virtualenv使用心得
- Python virtualenv 使用国内pip/easy_install创建虚拟环境