We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用Pyenv方便管理/切换Python版本
# 通过 Homebrew 安装 brew update brew install pyenv
# 使用 zsh shell vim ~/.zshrc # 使用系统默认 vim ~/.bash_profile
在 .zshrc 或 .bash_profile 文件最后写入:
export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
source ~/.zshrc # or source ~/.bash_profile
pyenv install --list
pyenv install 3.6.3
pyenv versions
已安装3.6.2 与 3.6.3 版本, 当前使用的版本: 3.6.3
# 对所有的Shell全局有效,会把版本号写入到~/.pyenv/version文件中 pyenv global 3.6.3 # 只对当前目录有效,会在当前目录创建.python-version文件 pyenv local 3.6.3 # 只在当前会话有效 pyenv shell 3.6.3 # 可通过配置PYENV_VERSION环境变量或编辑~/.python-version文件设置会话默认使用的python版本 echo "3.6.3" > ~/.python-version # or echo 'export PYENV_VERSION="3.6.3"' >> ~/.zshrc && source ~/.zshrc
只有 pyenv shell 和 pyenv local 命令有--unset参数
pyenv shell --unset pyenv local --unset
pyenv uninstall 3.6.3
pyenv-virtualenv 是pyenv的插件,为pyenv设置的python版本提供隔离的虚拟环境,设置虚拟环境后,在当前目录下面安装的第三方库都不会影响其他环境
brew update brew install pyenv-virtualenv
# pyenv-virtualenv if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
# 当前版本为3.6.3 pyenv virtualenv xxx-3.6.3
#pyenv virtualenv 版本号 虚拟环境名 pyenv virtualenv 3.6.3 xxx-3.6.3
# 手动激活 pyenv activate 虚拟环境名 pyenv deactivate # 自动激活 # 使用pyenv local 虚拟环境名 # 会把`虚拟环境名`写入当前目录的.python-version文件中 # 关闭自动激活 -> pyenv deactivate # 启动自动激活 -> pyenv activate xxx-3.6.3 pyenv local xxx-3.6.3
pyenv uninstall 虚拟环境名
The text was updated successfully, but these errors were encountered:
test
pyenv local 3.6.7
Sorry, something went wrong.
555
666666666
thank you
eteplus
No branches or pull requests
pyenv
1、安装
# 通过 Homebrew 安装 brew update brew install pyenv
2、配置
在 .zshrc 或 .bash_profile 文件最后写入:
3、使用
已安装3.6.2 与 3.6.3 版本, 当前使用的版本: 3.6.3
pyenv shell --unset pyenv local --unset
pyenv-virtualenv
1、安装
2、配置
在 .zshrc 或 .bash_profile 文件最后写入:
3、使用
# 当前版本为3.6.3 pyenv virtualenv xxx-3.6.3
#pyenv virtualenv 版本号 虚拟环境名 pyenv virtualenv 3.6.3 xxx-3.6.3
The text was updated successfully, but these errors were encountered: