SoFunction
Updated on 2024-11-12

Installing Python3 on CentOS7 Tutorial Analysis

View the system's original Python

Note: It is possible to point python to python3, but you have to change the configuration of some commands such as yum, otherwise it will report an error.

Installation of dependencies

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

Download python 3.8.1 (there are too many versions, I don't know which one to choose, I read the official docs, so let's start with stable/stable)

wget /ftp/python/3.8.1/Python-3.8.

Unzip and compile and install

[root@pmmy ~]# tar -xvf Python-3.8.

[root@pmmy ~]# cd Python-3.8.1

[root@pmmy Python-3.8.1]# ./configure --prefix=/usr/local/python3 --enable-optimizations

Note: --prefix= is to specify the directory to compile and install --enable-optimizations is an optimization for python that improves its performance.

[root@pmmy Python-3.8.1]# make && make install

Adding a Command Path

vim /etc/profile

Add in the last line:

export PATH=$PATH:/usr/local/python3/bin

Refresh Configuration File

source /etc/profile

beta (software)

This is the whole content of this article.