Linux system python3 installation

1. Download the Python source code from the official website and extract it to the specified directory.

wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
xz -d Python-3.6.1.tar.xz
tar -xvf Python-3.6.1.tar

2. Switch to the Python source code directory and execute the following commands to configure and install.

cd Python-3.6.1
./configure --prefix=/usr/local/python3.6 --enable-optimizations
make && make install

3. If the installation fails, install the dependent libraries (because without these dependent libraries, the source code component installation may fail due to the lack of the underlying dependent libraries)

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325504742&siteId=291194637