Linux Debian11 安装 Python3.9
TIME 2022-08-30 19:36
准备工作
先升级系统
apt update -y
更新软件包
apt upgrade -y
安装依赖
apt install -y wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
Python官方页面下载获取最新版本
https://www.python.org/ftp/python/
下载编译安装Python3.9
当前最新版是3.9.9,将其下载下来
wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz
解压下载的文件
tar xzf Python-3.9.9.tgz
进入Python-3.9.9目录
cd Python-3.9.9
运行配置命令并完成Python编译安装
./configure --enable-optimizations && make && make install
一键安装命令
apt update ; apt upgrade -y ; apt dist-upgrade -y ; apt install -y wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev ; wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz ; tar xzf Python-3.9.9.tgz ; cd Python-3.9.9 ; ./configure --enable-optimizations ; make ; make install ; python3 --version
如果一切顺利没有报错的话
检查python版本
python3 --version
返回结果
Python 3.9.9
安装完成
返回:《Linux Debian 11 学习笔记》 目录
点击数:30