centos7.6安装python3.8.3

1. 系统环境

CentOS 7.6自带了Python2.7.5,我们需要另行安装Python 3.8.3
在这里插入图片描述

2. 下载依赖包
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel
3. 下载安装包
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
4. 安装步骤
  • 解压
tar -zxvf Python-3.8.3.tgz
  • 进入解压目录
cd Python-3.8.3
  • 配置安装位置
./configure --prefix=/usr/local/python3
  • 安装
make && make install

安装成功后,/usr/local/目录下就会生成python3目录
在这里插入图片描述

5. 添加软连接
  • 添加python3的软链接
ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
  • 添加pip3的软链接
ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3
6. 测试

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

7. 配置国内pip源

国内常用pypi源:

中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple/
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云:https://mirrors.aliyun.com/pypi/simple/
豆瓣:https://pypi.douban.com/simple/

步骤如下:

# 创建.pip目录
mkdir ~/.pip
# 进入.pip目录下
cd ~/.pip
# 创建pip.conf文件
vim pip.conf

pip.conf文件内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

最后:对你有所帮助的话,记得点赞哦!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值