在centos7下安装python3.7.9

admin
2021-04-07 / 0 评论 / 1,201 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年04月10日,已超过1309天没有更新,若内容或图片失效,请留言反馈。

1、安装各种依赖包

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel

2、下载python3.7.9安装包并解压缩

wget "https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz"
tar -zxvf Python-3.7.9.tgz

3、编译安装

cd Python-3.7.9
./configure --prefix=/usr/local/python3
make && make install

4、创建软链接

ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

5、验证

[root@seeker-01 ~]# python
    Python 2.7.5 (default, Aug  7 2019, 00:51:29) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>>

[root@seeker-01 ~]# python3
    Python 3.7.9 (default, Aug 28 2020, 13:28:49) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
2

评论

博主关闭了所有页面的评论