CentOS 7: Method and precautions for installing python3.7.1

  • 2021-01-18 06:35:03
  • OfStack

Install wget

yum -y install wget

Create an download directory to download the various installation packages

mkdir download

Switch to the download directory you just created

cd download

Download python3. 7.1

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

Unpack the

tar -zxvf Python-3.7.1.tgz

Switch to the folder you just unzipped

cd Python-3.7.1

Install the configuration

./configure

no acceptable C compiler found in $PATH

This is because I don't have GCC in my system (I don't know what GCC is yet :sweat:)

Install 1 GCC

yum install gcc

Perform the installation configuration again

./configure

Compile the installation

make

make install

Again, an error. can't decompress data; zlib not available

zlib is not installed,

1 the installation

mkdir download0

Reinstall python-3.7.1

make install

dizzy_face: : No module named '_ctypes' dizzy_face: : No module ctypes'

Is not installed libffi-devel

1 the installation

yum install libffi-devel -y

Reinstall python-3.7.1

make install

OK now, enter python3 -V to see the version number to prove that you have successfully installed

PS: At this point, if you type python-V, you will find that the system is still using python version 2.7. This is because you have not switched to the new version of python. However, I recommend not to switch to python because there are other software in the system that depend on 2.7, which will cause problems.

conclusion


Related articles: