centos7.9编译安装python3.7.2

联网环境下编译安装python3.7.2,不联网则需要配置cnetos7.9离线源

下载解压软件包

[root@localhost ~]# tar -xf Python-3.7.3.tar.gz
[root@localhost ~]# ls
anaconda-ks.cfg  Python-3.7.3  Python-3.7.3.tar.gz
[root@localhost ~]#
[root@localhost ~]# cd Python-3.7.3
[root@localhost Python-3.7.3]# ls
aclocal.m4           config.sub    Doc      install-sh  m4               Misc     Parser   Programs       README.rst
CODE_OF_CONDUCT.rst  configure     Grammar  Lib         Mac              Modules  PC       pyconfig.h.in  setup.py
config.guess         configure.ac  Include  LICENSE     Makefile.pre.in  Objects  PCbuild  Python         Tools
[root@localhost Python-3.7.3]#

安装依赖

[root@localhost Python-3.7.3]# yum install -y zlib zlib-devel gcc libffi libffi-devel

编译安装

[root@localhost Python-3.7.3]# ./configure
[root@localhost Python-3.7.3]# make
[root@localhost Python-3.7.3]# make install

验证

[root@localhost Python-3.7.3]# python3 --version
Python 3.7.3
[root@localhost Python-3.7.3]# python3
Python 3.7.3 (default, Nov  2 2023, 10:28:15)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

你可能感兴趣的:(Linux,python)