在CentOS 6.5下的virtualenvwrapper的使用

19 篇文章 0 订阅

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 清除环境内所有第三方包


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值