基础环境
虚拟机:VMware® Workstation 16 Pro 16.0.0 build-16894299
Linux版本:ubuntu-16.04.7-desktop-amd64
设备:pixel 6a;代号:bluejay;
基础软件安装
安装 Git
命令:sudo apt install git
安装 Python 3.7
1、下载 python 3.7
命令:wget Python Release Python 3.8.17 | Python.org
2、解压 python 3.7
命令:tar xvf python.tar.gz
3、配置 python 3.7
a)进入解压好的 python 3.7 目录
命令:cd Python-3.7.17
b)执行 configure 脚本:
命令:./configure
如果执行结果中包含以下报错信息,则需要安装 openSSL:
报错:checking whether compiling and linking against OpenSSL works... no
c)安装 openSSL 相关依赖包:
命令:sudo apt install git-core libssl-dev libffi-dev gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev libz-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip
安装完 openSSL 后再次执行 configure 文件可以看到此信息:
checking whether compiling and linking against OpenSSL works... yes
4、编译与安装Python3:
命令:sudo make install
配置update-alternatives
--将 python 交给 update-alternatives 管理,可随时切换软件版本
a)将 python3.7 和 phthon2.7 加入快捷管理
命令:
update-alternatives --install /usr/bin/python python python3的安装地址(/usr/local/bin/python3.7 3(权重号))
update-alternatives --install /usr/bin/python python python2的安装地址(/usr/bin/python2.7 2(权重号))
b)切换Python版本:
命令:update-alternatives --config python