Centos7 源码安装python3

虚拟机中安装了Centos7操作系统,系统自带python 2.7                       

[root@bogon opt]# python
Python 2.7.5 (default, Apr  2 2020, 13:16:51) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

现需安装python3,采用源码安装 。

源码下载地址:Index of /ftp/python/3.8.0/Python-3.8.0.tgz

将下载文件上传到/opt目录下,进入/opt进行解压

cd /opt
tar -xvf Python-3.8.0.tgz

安装依赖

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

 进入解压后文件夹,执行编译

./configure
make
make install

执行python命令查看是否安装成功

[root@bogon Python-3.8.0]# python3
Python 3.8.0 (default, Sep 30 2022, 19:00:39) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值