liangzuojiayi 2020-01-28
0.配置依赖环境,如果不进行这步可能会出现一些问题
sudo apt-get install zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev
1.去官网下载Python-3.8.1.tar.xz
wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tar.xz
2.解压下载的包
tar -xvJf Python-3.8.1.tar.xz
3.进入解压后的目录
cd Python-3.8.1/
4.安装依赖
执行下列命令安装依赖过程中,如有提示,一律 y 。
sudo apt-get install python-dev
sudo apt-get install libffi-dev
sudo apt-get install libssl-dev
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev
5.anzhuang
./configure --with-ssl
make
sudo make install
6.tianjiayinyong
#将原来的链接备份
mv /usr/bin/python /usr/bin/python.bak
#添加python3的软链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python
#测试是否安装成功了
python -V