pyenv+virtualenv建立多版本隔离python环境

1、安装pyenv

参考:https://github.com/yyuu/pyenv-installer
python

$ curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
$ vim .bash_profile
	export PATH="$HOME/.pyenv/bin:$PATH"
	eval "$(pyenv init -)"
	eval "$(pyenv virtualenv-init -)"
$ source .bash_profile
$ pyenv update

2、使用pyenv安装python

$ pyenv install 2.7
$ pyenv versions
	* system (set by /home/xxx/.pyenv/version)
	  2.7

3、使用virtualenv

1. 建立虚拟python环境
git

$ pyenv virtualenv 2.7 v_py27
$ pyenv verions
	* system (set by /home/xxx/.pyenv/version)
	  2.7
	  v_py27

2. activate和deactivate github

$ pyenv activate v_py27
$ pyenv deactivate

4、修改默认python环境

$ pyenv gobal v_py27
相关文章
相关标签/搜索