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
2. 安装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
3. 安装 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
4.设置全局python版本
pyenv global 3.7.0
网友评论