Pyenv
Source https://github.com/pyenv/pyenv https://github.com/pyenv/pyenv-virtualenv Install pyenv 安装 curl -fsSL https://pyenv.run | bash 手动安装 git clone https://github.com/pyenv/pyenv.git ~/.pyenv 加入环境变量: export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" pyenv virtualenv 安装 git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv mac 上可以通过 brew install pyenv-virtualenv 来安装 确认已经有的环境 pyenv versions 删除 一般使用 pyenv uninstall <python-version> 手动删除 rm -rf ~/.pyenv/versions/<python-version> 删除后,为了清理缓存并让 pyenv 重新生成 shim,可以运行: pyenv rehash 使用 python install pyenv install --list 列出可选的python版本 pyenv install <python-version> 该目录下使用特定环境 pyenv local myproject-env 执行后目录下会生成.python-version ,进入该目录或其子目录时,pyenv 会自动切换到对应环境。 ...