多版本python管理pyenv
pyenv安装: https://github.com/yyuu/pyenv#choosing-the-python-version
pyenv命令: https://github.com/yyuu/pyenv/blob/master/COMMANDS.md
pyenv virtualenv插件安装: https://github.com/yyuu/pyenv-virtualenv
pyenv commands
Lists all available pyenv commands.
不同python版本间的切换使用
pyenv local version or --unset
pyenv global version or --unset
pyenv shell version,version or --unset
pyenv version
Displays the currently active Python version, along with information on how it was set.
pyenv versions
Lists all Python versions known to pyenv, and shows an asterisk next to the currently active version.
pyenv which
Displays the full path to the executable that pyenv will invoke when you run the given command.
$ pyenv which python3.3
/home/yyuu/.pyenv/versions/3.3.3/bin/python3.3
pyenv rehash
Installs shims for all Python binaries known to pyenv (i.e., ~/.pyenv/versions/*/bin/*
). Run this command after you install a new version of Python, or install a package that provides binaries.
$ pyenv rehash
1、查看可以安装的版本
pyenv install -l
2、安装python2.7.8
pyenv install 2.7.8
如果失败参考: https://github.com/yyuu/pyenv/wiki/Common-build-problems
3、创建一个使用指定版本python虚拟环境(注意:python-version必须是pyenv安装的版本)
pyenv virtualenv python-version virtual-env-name
4、创建一个使用当前python版本的虚拟环境
pyenv virtualenv virtual-env-name
5、激活虚拟环境(注意这个虚拟环境必须是pyenv创建的)
pyenv activate virtual-env-name
6、退出虚拟环境
pyenv deactivate
7 、显示已存在的虚拟环境
pyenv virtualenvs
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。