virtualenvwrapper-win安装

这两天研究一下python的环境隔离,感觉virtualenvwrapper还是不错的,并且集成了virtualenv直接安装了就可以,比单独virtualenv要好用。这里不得不说一下,看英文文档和看英文问答网站的重要性,virtualenvwrapper-win的中文资料几乎没有,而virtualenv又是大家互相学互相抄,都说virtualenvwrapper没必要只是一个virtualenv的管理工具,谁知virtualenvwrapper才是真的好用。

# using pip

pip install virtualenvwrapper-win       这就不必说了 注意后面-win

这里这句话,研究好长时间,意思说默认安装路径是user文件夹,但是怎么改 WORKON_HOME没说...我勒个擦

Optional: Add anenvironmentvariable WORKON_HOME to specify the path tostoreenvironments. By default, this is%USERPROFILE%\Envs.

还好最后还是查到了资料,但是已经是第二天。

AS lguananut said, you are asking how to set anenvironment variable. Take Win7 as example,

executecommand "sysdm.cpl"

Go toAdvanced tab, open "EnviromentVariables..."

New a system variable

Inpop window, set variable name = WORKON_HOME, value = [your virtual environments root]

relaunch one command prompt, all commands like mkvirtualenv, workon will works.

方法非常的惊人,在windows里自己设置一个环境变量叫WORKON_HOME,注意设置完要重新开一个cmd,然后...成功了。

然后就是使用了,其实使用非常简单,也是说他好用的原因。

mkvirtualenv    创建虚拟环境 

Create a new virtualenv environment named. The environment will be created in WORKON_HOME.

lsvirtualenv                 列出已有虚拟环境

List all of the enviornments stored in WORKON_HOME.

rmvirtualenv 删除

Remove the environment. Usesfolder_delete.bat.

workon []      开启哪一个工作

Ifis specified, activate the environment named(change the working virtualenv to). If a project directory has been defined, we will change into it. If no argument is specified, list the available environments. One can pass additional option -c after virtualenv name to cd to virtualenv directory if no projectdir is set.

deactivate               关闭

Deactivate the working virtualenv and switch back to the default system Python.

add2virtualenv  未知,貌似是改成可移植环境,不确定,暂时没用到。

If a virtualenv environment is active, appendstovirtualenv_path_extensions.pthinside the environment’s site-packages, which effectively addsto the environment’s PYTHONPATH. If a virtualenv environment is not active, appendstovirtualenv_path_extensions.pthinside the default Python’s site-packages. Ifdoesn’t exist, it will be created.

最后,就着百度翻译看英文文档吧,比找中文二手资料要方便多了。

你可能感兴趣的:(virtualenvwrapper-win安装)