Featured image of post 在centos7下安装python3.7.9

在centos7下安装python3.7.9

1、安装各种依赖包

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安装包并解压缩

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

3、编译安装

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

4、创建软链接

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

5、验证

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[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.
    >>>
comments powered by Disqus
本博客已稳定运行
发表了77篇文章 · 总计103.35k字