CentOS7 mounted Python3.7.4 (coexistence with python2.x)

First statement about, because this blog is experiencing too much copy and paste, do not be verified blog, plus I just reset a bit server, the newly installed python3.7 also encountered some problems, need to be reconfigured.

Tribute bloggers! Reference blog as follows:

Source blog address: https://blog.csdn.net/qq_39091354/article/details/86584046   Title: centos7 + Python3.7 proper installation of (and Python2.X coexistence)

Source blog address: https://blog.csdn.net/qq_36416904/article/details/79316972 solution No module named '_ctypes': Subject: ModuleNotFoundError error when installing python3.7.0 or later on in centos

 

We need to achieve in the centos7.4, installation Python3.7.4 (latest version), and also comes with the server python2 coexist.

1. Open the python's official website, we downloaded the python tgz file :( here is because the server does not use wget command to download using the slower, I choose to download the upload up)

Download python official website: https://www.python.org/downloads/release/python-374/

2. Upload the file:

Use xftp upload files to / usr / local:

After uploading up, the file already exists under local directory.

3. Unzip the file:

tar zxvf downloaded file name

Example:

tar zxvf Python-3.7.4.tgz (my version is 3.7.4)

After the extraction is completed, the next local directory there is a Python-3.7.4 folder

4. Installation depends add:

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 gcc libffi-devel gcc make automake autoconf libtool libffi-devel

libffi-devel This is a new package version 3.7 required, this package is very important, if this package is not installed, will be installed when the error: ModuleNotFoundError: No Module named '_ctypes'

I have been installed here, it has been installed

The extract directory into the Python-3.7.4:

cd Python-3.7.4

6. The initial configuration:

./configure --prefix = / usr / local / python3 (here I installed under / usr / local / python3 directory, there needs to be installed in other parts of the modified directory to the location you want to install)

7. perform the installation:

make && make install 

8. The configuration software is connected to the installation is complete:

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

9. Verify:

python3 -V

PIP3 -V

 

Return the version information for the installation of the installation is successful, the next upgrade pip3

pip3 install --upgrade pip

yum command can be used as usual, to this end of the installation.

Guess you like

Origin www.cnblogs.com/blackmanzhang/p/11247645.html