下载最新版的Python
1. 官网下载python-3.6.4
https://www.python.org/downloads/source/
2. 安装readline库
sudo apt-get install libreadline-dev
3. 安装所需的关联项
sudo apt-get install libbz2-dev libncurses5-dev libgdbm-dev liblzma-dev libsqlite3-dev libssl-dev libreadline6-dev
安装Python 3.6.4
在下载的文件目录下执行:
xz -d Python-3.6.4.tar.xz tar -xvf Python-3.6.4.tar cd Python-3.6.4 ./configure make sudo make install
在终端 执行 vim /etc/profile 在环境变量中添加python路径
PATH=$PATH:/usr/local/python3.6/bin