CentOS installation python3

1, cd /usr/local

sudo yum -y install wget

share picture

2, wget https://www.python.org/ftp/python/ 3.7.2/Python-3.7.2.tar.xz

share picture< /p>

3, tar -xf Python-3.7.2.tar.xz

4, mkdir python3

< p>5, mv Python-3.7.2 python3

6, cd python3

7, ./configure –prefix=/usr/local/python3 –enable-optimizations for the first time The error is reported as follows

(

The --prefix option is to configure the installation path. After execution, all resource files are placed in the path of /usr/local/python3.6

< p>)

share picture

Indicating the lack of gcc compilation environment in this machine

Then you need to sudo yum install -y gcc

Run again. /configure –prefix=/ usr/local/python3 –enable-optimizations

8, make

9, make altinstall

share picture

Solution to the above error:

sudo yum install zlib zlib-devel -y

share picture

Solution to the above error:

sudo yum install libffi-devel -y

Run again make altinstall

share picture

< p> 10. After the installation is complete, modify the soft connection

ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3

ln -s /usr/ local/python3/bin/pip3.7 /usr/bin/pip3

11. Check the installed version

share picture

Leave a Comment

Your email address will not be published.