linux 安装python3.7.5

前言

linux默认自带的是python2的版本,python2的版本目前已经不演进,且存在诸多漏洞,现在大部分python项目都要求是python3。

版本信息

[root@izj6ce3t4tj14n513a5790z bin]# cat /proc/version
Linux version 3.10.0-862.11.6.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Tue Aug

安装过程

# 安装依赖
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel
# 获取大包
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
tar xvf Python-3.7.5.tgz
cd Python-3.7.5
# 编译
./configure --prefix=/usr/local/python3
make
make install
# 建立软链接
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
# 验证
[root@izj6ce3t4tj14n513a5790z bin]# python3
Python 3.7.5 (default, Jan 23 2020, 10:28:05)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

posted on 2020-01-23 10:45  harry1989  阅读(1029)  评论(0编辑  收藏  举报

导航