1. 安装依赖包
sudo apt-get update
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev
  1. 安装pyenv
 git clone git://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
exec $SHELL -l
  1. 安装 python3.7.0
pyenv install 3.7.0 -v

3.1 安装完成之后,需要使用如下命令对数据库进行更新:

pyenv rehash

3.2 查看已经安装的python版本:

pyenv versions
* system (set by /root/.pyenv/version)
3.7.0
  1. 设置全局python版本
pyenv global 3.7.0

pyenv快速入门

05-19 05:06