
[root@localhost ~]# yum -y install zlib-devel bzip2-devel openssl-devel sqlite-devel readline-devel gcc make pcre pcre-devel[root@localhost ~] wget https://www.python.org/ftp/python/3.6.7/Python-3.6.7rc2.tgzvi Python-3.6.5/Modules/Setup.dist
修改
readline readline.c -lreadline -ltermcapSSL=/usr/local/ssl_ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto[root@localhost Python-3.6.7rc2] ./configure --enable-shared[root@localhost Python-3.6.7rc2] make && make installvi /etc/profile.d/python3.6.7lib.sh
增加这么一行
#python-3.6.7共享库目录export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/libvi /etc/ld.so.conf.d/python3.conf
增加如下内容
/usr/local/lib保存退出[root@localhost ~]# ldconfig[root@localhost ~]# source /etc/profile
检查能否安装成功、出现如下内容表示安装成功
[root@localhost ~]# python3Python 3.6.7 (default, Dec 24 2018, 11:03:47) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linuxType "help", "copyright", "credits" or "license" for more information.>>> exit()退出
[root@localhost ~]# python3Python 3.6.7 (default, Dec 24 2018, 11:03:47) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linuxType "help", "copyright", "credits" or "license" for more information.>>> exit()#!/bin/bash#lyoyo#install python3.6.7yum -y install zlib-devel bzip2-devel openssl-devel sqlite-devel readline-devel gcc make pcre pcre-develwget https://www.python.org/ftp/python/3.6.7/Python-3.6.7rc2.tgztar xf Python-3.6.7rc2.tgzsed -i "s/^#readline/readline/g" Python-3.6.7rc2/Modules/Setup.distsed -i "s/^#SSL/SSL/g" Python-3.6.7rc2/Modules/Setup.distsed -i "s/^#_ssl/_ssl/g" Python-3.6.7rc2/Modules/Setup.distsed -i "s/^#[\t]*-DUSE_SSL/-DUSE_SSL/g" Python-3.6.7rc2/Modules/Setup.distsed -i "s/^#[\t]*-L\$(SSL)/-L\$(SSL)/g" Python-3.6.7rc2/Modules/Setup.distcd Python-3.6.7rc2./configure --enable-sharedmake && make installecho "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" >> /etc/profile.d/python-3.6.7_lib.shecho "/usr/local/lib" >> /etc/ld.so.conf.d/python3.confldconfigsource /etc/profile