Linux installation python3 (CentOS7)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_41596915/article/details/99617910

Installation Python3

gcc -v # 查看gcc编译器的版本

#如果没有gcc编译器,则需要安装
yum -y install gcc

#可能还需要其他依赖包,根据提示下载

#下载Python3.7.0源码(tgz格式)
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

#解压Python-3.7.0.tgz
tar -zxvf Python-3.7.0.tgz -C /usr/local/python3

#执行配置文件
cd Python-3.7.0
./configure

#编译
make

#编译安装
make install

Test Python3

[ziyang0421@localhost Python-3.7.0]$ pip3 --version
pip 10.0.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
[ziyang0421@localhost Python-3.7.0]$ python3
Python 3.7.0 (default, Aug 14 2019, 21:41:28) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World")
Hello World


Guess you like

Origin blog.csdn.net/qq_41596915/article/details/99617910