centos7安装python3

Posted go-spurs-go

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7安装python3相关的知识,希望对你有一定的参考价值。

很简单,但是每次安装都要现查,做个记录

cd /tmp
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
mkdir /usr/local/python3 
mv Python-3.6.7.tar.xz /usr/local/python3/
cd /usr/local/python3/
tar xf Python-3.6.7.tar.xz 
cd Python-3.6.7
./configure --prefix=/usr/local/python3
make && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

  

验证:

python3
Python 3.6.7 (default, Aug 12 2019, 00:26:52) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> 
>>> 

  

  

以上是关于centos7安装python3的主要内容,如果未能解决你的问题,请参考以下文章

centos7下安装python3.8

Centos7上安装python3.7

Centos7.6安装python3

CentOS7安装Python3

Centos7上安装Python3

centos7 安装python3.6 及模块安装演示