CentOS 7源码安装Python3.8
2021/11/3 7:09:36
本文主要是介绍CentOS 7源码安装Python3.8,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1.安装依赖包
yum groupinstall "Development tools" yum -y install gcc libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
2.下载对应的安装包
wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz (官方地址,很慢) wget https://npmmirror.com/mirrors/python/3.8.12/Python-3.8.12.tgz (阿里镜像,建议使用)
3.解压并安装python
# 解压源码包 tar -zxvf Python-3.8.12.tgz # 创建安装目录 mkdir -p /usr/local/python38 # 进入python解压目录 cd Python-3.8.12/ # 配置安装目录 ./configure --prefix=/usr/local/python38 # 编译并安装 make && make install
4.添加python软链接
这里不建议修改默认的软链接,因为yum等软件会使用到默认的python2版本,如果修改了默认的软链接,需要修改yum源码才能让yum正常运行
ln -s /usr/local/python38/bin/python3.8 /usr/bin/python3 ln -s /usr/local/python38/bin/pip3.8 /usr/bin/pip3
终于安装完了,来测试一下吧
python3 --version pip3 -V
这篇关于CentOS 7源码安装Python3.8的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-03用FastAPI掌握Python异步IO:轻松实现高并发网络请求处理
- 2025-01-02封装学习:Python面向对象编程基础教程
- 2024-12-28Python编程基础教程
- 2024-12-27Python编程入门指南
- 2024-12-27Python编程基础
- 2024-12-27Python编程基础教程
- 2024-12-27Python编程基础指南
- 2024-12-24Python编程入门指南
- 2024-12-24Python编程基础入门
- 2024-12-24Python编程基础:变量与数据类型