在Ubuntu上安装Python3.9
时间: 2024-04-09 14:21:35 浏览: 165
ubuntu安装python3.9 ubuntu安装python3.9
5星 · 资源好评率100%
你可以按照以下步骤在Ubuntu上安装Python3.9:
1. 打开终端并更新Ubuntu软件包列表:
```
sudo apt update
```
2. 安装依赖项:
```
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
```
3. 下载Python3.9的源代码:
```
wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz
```
4. 解压缩源代码:
```
tar -xf Python-3.9.0.tgz
```
5. 进入解压缩后的目录:
```
cd Python-3.9.0
```
6. 配置Python3.9的安装选项:
```
./configure --enable-optimizations
```
7. 编译Python3.9:
```
make -j $(nproc)
```
8. 安装Python3.9:
```
sudo make altinstall
```
现在,Python3.9已经成功安装到Ubuntu上了。你可以在终端中输入`python3.9`命令来启动Python3.9解释器。
阅读全文