Notes on installing python 3.6 under centos 7

Every time you install python 3 on centos, you need to check the information again. This time, I simply take notes.

First install gcc

yum -y install gcc
yum install zlib-devel
./configure --prefix=/usr/local
make
make altinstall

Create soft links

cd/usr/bin
mv python python.backup
ln -s /usr/local/bin/python3.6 /usr/bin/python
ln -s /usr/local/bin/python3.6 /usr/bin/python3

In fact, the installation of python 3 is completed here, but if we use the pip installation framework, it may be installed in the python 2.7 directory for us and
change the python dependency of the yum script (I don't know if the apt tool under Ubuntu is a dependency or not For python, but yum under centos does depend on Python)
# cd /usr/bin
# ls yum*
yum yum-config-manager yum-debug-restore yum-groups-manager
yum-builddep yum-debug-dump yumdownloader
Change the above file header to
#!/usr/bin/python to #!/usr/bin/python2

Guess you like

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