Skip to content

Instantly share code, notes, and snippets.

@vimiix
Created August 31, 2022 01:26
Show Gist options
  • Save vimiix/e62fa85a1fec482600f71afff794633f to your computer and use it in GitHub Desktop.
Save vimiix/e62fa85a1fec482600f71afff794633f to your computer and use it in GitHub Desktop.
How to install python3.7 on CentOS

Step 1 – Requirements

安装编译解释器所需的依赖

yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel 

Step 2 – Download Python 3.7

cd /usr/src  
wget https://www.python.org/ftp/python/3.7.11/Python-3.7.11.tgz  
tar xzf Python-3.7.11.tgz 

Step 3 – Install Python 3.7

cd Python-3.7.11 
./configure --enable-optimizations 
make altinstall 

make altinstall 用于防止替换系统自带的 python 二进制文件 /usr/bin/python

安装完后即可删除安装包

rm /usr/src/Python-3.7.11.tgz 

Step 4 – Check Python Version

python3.7 -V 
# Output: Python 3.7.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment