CentOS installation is python3


1. install dependencies

不要复制往下看 yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel 如果在后面提示缺少 _ctypes  那么安装这个↓ yum install libffi-devel -y 

Above this one is something I first installed fashion, but there are a lot of problems later, stay here to be a memorial, the following is the full

yum install gcc openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel libffi-devel tk-devel wget curl-devel  

2. Quguan network to find the download link

先进入下载目录 cd /tmp wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz 

3. Extract the corresponding file

tar -zxvf Python-3.7.2.tgz  

4. Cover a house for your Python3

mkdir /usr/local/python3 

5. Then compile

Python-3.7.2/configure --prefix=/usr/local/python3/ 

If this report ↓ mistake, which no explanation gcc

configure: error: no acceptable C compiler found in $PATH 

Then install a

yum install gcc 

Installing gcc compiler with it again
if there is no module _ctypes then appear with the first download libffi-devel then compiled again! !

6. Then make it (this command is doing)

make 

7. Then make install

make install 

If ModuleNotFoundError appears: No module sssssnamed '_ctypes', in fact, can also use the
want to solve, then look at this, I have not tried https://blog.csdn.net/itdabaotu/article/details/83105947

8. build a soft link ease of use

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

Well, you can run directly into the python3

9. Your pip3 also built a soft link bar

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

Guess you like

Origin www.cnblogs.com/LiuYanYGZ/p/12041775.html