您的位置:首页 > 运维架构 > Linux

在CentOS 6.5下的virtualenvwrapper的使用

2014-09-16 16:43 211 查看
1,先yum intall virtualenv

2,然后pip install virtualenvwrapper

安装完需要配置:

vim ~/.bash_profile


下面代码添加到后面

Shell Startup File

Add three lines to your shell startup file (.bashrc, .profile, etc.) to set the location where the virtual environments should live, the location of your development project directories, and the location of the script installed with this package:

#virtualenvwrapper
export WORKON_HOME=$HOME/virtualenvs # 虚拟环境存放位置自己指定
source /usr/bin/virtualenvwrapper.sh # 指定virtualenvwrapper的执行文件路径
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python # 系统python2.7执行文件位置,根据自己环境而定
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' # 启动时候指定参数,就是我们用的独立于系统的安装包
export PIP_VIRTUALENV_BASE=$WORKON_HOME # 告知pip virtualenv的位置
export PIP_RESPECT_VIRTUALENV=true # 执行pip的时候让系统自动开启虚拟环境


After editing it, reload the startup file (e.g., run source ~/.bashrc).

执行:

source ~/.bash_profile


这里我没理解,我直接在shell里运行这三个命令也是可以的

-------------------------------------------------------------------------------------------------------------------------安装和配置完了

下面是使用:

mkvirtualenv demo1

workon 切换到环境

deactivate 注销当前环境

lsvirtualenv 列出所有环境

rmvirtualenv 删除环境

cpvirtualenv 复制环境

cdsitepackages cd到当前环境的site-packages目录

lssitepackages 列出当前环境中site-packages内容

setvirtualenvproject 绑定现存的项目和环境

wipeenv 清除环境内所有第三方包
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: