- 更新软件包列表并安装构建Python所需的软件包
- apt update
- apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
- 下载Python3.8的源代码
- mkdir /home/download;cd /home/download
- wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
- 安装python3.8
- tar -xf Python-3.8.0.tgz
- cd Python-3.8.0
-
./configure --enable-optimizations --prefix=/usr/local/python3
- make && make install
- ln -s /usr/local/python3/bin/python3.8 /usr/bin/python
- ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip
- 验证
- python -V
- pip -V
- sh脚本: apt update;apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget;mkdir -p /home/download;cd /home/download;cp /nas_data/Python-3.8.0.tgz .;tar -xf Python-3.8.0.tgz;cd Python-3.8.0;./configure --enable-optimizations --prefix=/usr/local/python3;make && make install;ln -snf /usr/local/python3/bin/python3.8 /usr/bin/python3;ln -snf /usr/local/python3/bin/pip3.8 /usr/bin/pip3;python3 -V;pip3 -V
ubuntu安装python3.8
于 2022-05-13 11:00:16 首次发布