Compiling and Installing Python 3.7 on CentOS 7

System Environment

  • Host: Windows 10 Pro with VMWare Workstation 15 Pro
  • Guest: CentOS 7.6.1810 (Core)
  • Privilegse: Root user

Procedure

Refresh the package index and upgrade instaleld packages.

yum update -y

Install required development libraries and tools.

yum groupinstall "Development Tools" -y
yum 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 -y

Download the Python 3.7.0 source code.

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

Extract the downloaded archive.

tar -xzf Python-3.7.0.tgz

Navigate to the source directory and configure the build.

cd Python-3.7.0
./configure --prefix=/usr/local/python37 --enable-shared

Compile the source using all available CPU cores and install.

make -j $(nproc)
make altinstall

Create symbolic links for the new Python interpreter and pip.

ln -sf /usr/local/python37/bin/python3.7 /usr/local/bin/python3
ln -sf /usr/local/python37/bin/pip3.7 /usr/local/bin/pip3

Tags: centos python compilation installation Linux

Posted on Sun, 12 Jul 2026 17:16:23 +0000 by thom2002