linux 安装 python3.10
时间: 2023-11-16 09:52:24 浏览: 158
安装部署-linux安装python3.10教程
如果你想在Linux上安装Python 3.10,以下是步骤:
1. 下载Python 3.10源码包:
```
wget https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz
```
2. 安装Python相关的依赖包:
```
yum install -y gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
```
3. 解压Python源码包:
```
tar -zxf Python-3.10.5.tgz
cd Python-3.10.5
```
4. 配置、编译和安装:
```
./configure --prefix=/usr/local/python3/
make && make install
```
5. 添加环境变量:
```
echo "PATH=/usr/local/python3/bin:$PATH" >> /etc/profile
source /etc/profile
```
6. 创建软连接:
```
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
```
7. 验证安装成功:
```
python -V
```
通过上述步骤,你就可以在Linux系统上安装Python 3.10了。请注意,这里我们将原先的Python改名,并创建了一个指向Python 3.10可执行文件的软链接,以确保系统中同时存在Python 2和Python 3,并且不会影响yum和防火墙等功能的正常使用。
希望对你有帮助!
阅读全文