转发https://www.cnblogs.com/resn/p/10135953.html
编译安装Python3
安装依赖
yum install -y ncurses-libs zlib-devel mysql-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
发现的问题:如果不安装readline-,python解释器无法使用上下左右箭头; 不安装openssl-, pip无法使用,不安装zlib-devel,编译无法通过。其他问题待发现后再补充。
下载安装包
wget https://www.python.org/ftp/python/3.6.7/Python-3.6.7.tar.xz
这里以root身份运行以下命令:
tar xf Python-3.6.7.tar.xz
cd Python-3.6.7
./configure && echo ok
make && make install && echo ok
安装后验证
执行
Python 3.6.7 (default, Dec 17 2018, 22:06:24)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
[root@t ~]# pip3 list
Package Version
---------- -------
pip 18.1
setuptools 39.0.1