pyenv lets you easily switch between multiple versions of Python. It’s simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.
This project was forked from rbenv and ruby-build, and modified for Python.
pyenv does…
Let you change the global Python version on a per-user basis.
Provide support for per-project Python versions.
Allow you to override the Python version with an environment variable.
Search commands from multiple versions of Python at a time. This may be helpful to test across Python versions with tox.
In contrast with pythonbrew and pythonz, pyenv does not…
Depend on Python itself. pyenv was made from pure shell scripts. There is no bootstrap problem of Python.
Need to be loaded into your shell. Instead, pyenv’s shim approach works by adding a directory to your $PATH.
Manage virtualenv. Of course, you can create virtualenv yourself, or pyenv-virtualenv to automate the process.
# 初始化 pyenv init # Load pyenv automatically by appending # the following to ~/.zshrc:
eval"$(pyenv init -)"
# 重启zsh exec"$SHELL"
# 切换版本 pyenv global 2.7.15 pyenv shell 3.6.7
# 查看版本 pyenv versions system 2.7.15 * 3.6.7 (set by PYENV_VERSION environment variable)
# 升级切换python版本 pyenv install 3.10 pyenv global 3.10.10
pyenv install 3.11 pyenv global 3.11.2
# pyenv 常用的命令说明
使用方式: pyenv <命令> [<参数>]
命令: commands 查看所有命令 local 设置或显示本地的Python版本 global 设置或显示全局Python版本 shell 设置或显示shell指定的Python版本 install 安装指定Python版本 uninstall 卸载指定Python版本) version 显示当前的Python版本及其本地路径 versions 查看所有已经安装的版本 which 显示安装路径
pyenv pyenv 1.2.8 Usage: pyenv <command> [<args>]
Some useful pyenv commands are: commands List all available pyenv commands local Set or show the local application-specific Python version global Set or show the global Python version shell Set or show the shell-specific Python version install Install a Python version using python-build uninstall Uninstall a specific Python version rehash Rehash pyenv shims (run this after installing executables) version Show the current Python version and its origin versions List all Python versions available to pyenv which Display the full path to an executable whence List all Python versions that contain the given executable
See `pyenv help <command>' for information on a specific command. For full documentation, see: https://github.com/pyenv/pyenv#readme
# 安装期间出现 SSL 或 pycurl 错误 __main__.ConfigurationError: Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.