Pyenv安装步骤及错误解决方案
1.一键安装(需要科学上网)
curl https://pyenv.run | bash
或者
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
2.环境变量设置
-
通过在终端运行以下命令添加到
~/.bashrc
中echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo 'eval "$(pyenv init -)"' >> ~/.bashrc
3.重新启动shell
exec "$SHELL"
4.安装python的构建依赖
-
ubuntu
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev curl git \ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev lib