扩展源安装
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
# 按回车继续
sudo apt install python3.7
python3.7 --version
#安装pip
wget https://bootstrap.pypa.io/get-pip.py
python3.7 get-pip.py
#安装python3.7-develop 包
sudo apt install python3.7-dev
源码安装
sudo apt updatesudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
tar -xf Python-3.7.3.tar.xz
cd Python-3.7.3
#配置
./configure --enable-optimizations
#编译 使用8个cpu同时编译
make -j 8
#安装python3.7
sudo make altinstall
#测试
python3.7 --version
#安装pip
wget https://bootstrap.pypa.io/get-pip.py
python3.7 get-pip.py
#安装python3.7-develop 包
sudo apt install python3.7-dev
原文地址:https://www.cnblogs.com/lovesKey/p/11355630.html
时间: 2024-10-12 02:21:25