一、安装编译工具包

Debian

sudo apt-get install -y build-essential

Centos

sudo yum install zlib-devel sudo yum groupinstall -y "Development Tools"

二、安装 sqlite3 开发包(可选)

Debian

sudo apt-get install -y libsqlite3-dev

Centos

sudo yum install -y sqlite-devel

三、下载 python3 源码包,解压,编译

Python 下载

cd /usr/local/src
sudo wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
sudo tar xfvz Python-3.5.2.tgz
cd Python-3.5.2
sudo ./configure
sudo make && sudo make altinstall

这样就安装好了,输入 python3.5 试下,应该会打开 python3.5 的命令行解释器

相关链接:

build-python-from-source