ubuntu18.04安装python3.7
时间: 2023-05-01 16:01:11 浏览: 279
python3.7安装
1. 更新软件源:
```sudo apt update```
2. 安装依赖:
```sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget```
3. 下载Python3.7源码:
```wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz```
4. 解压并进入目录:
```tar -xf Python-3.7.0.tar.xz && cd Python-3.7.0```
5. 编译安装:
```./configure --enable-optimizations && make && sudo make altinstall```
6. 检查版本:
```python3.7 -V```
注意: 使用`make altinstall`而不是`make install`可以防止覆盖系统默认的Python版本。
阅读全文