type
status
date
summary
slug
tags
category
password
icon

CentOS_7 安装Python3

  • CenOS_7自带安装的Python版本为2.7.5,在目前一些场景下运行的Python程序需要Python3支持,故需要安装Python3
  • 最终结果为Python2Python3共存

一、Python源代码编译安装

(1)安装yum-utils

  • yum-utils的功能是管理repository及扩展包的工具 (主要是针对repository)

(2)构建环境

  • 使用yum-builddepPython3构建环境,安装缺失的软件依赖,使用下面的命令会自动处理

(3)下载Python3源码包

(4)编译安装Python3

  • 默认的安装目录是/usr/local
    • 如果要修改目录,在编译(make)前,使用configure命令后面追加参数prefix=/alternative/path来完成修改
  • 若最后没提示出错,代表已正确安装,在/usr/local/目录下就会有python3目录

二、测试及使用

(1)添加软链接

  • 查看版本
notion image

(2)永久换源

  • 清华源
  • 阿里源
  • 腾讯源
  • 豆瓣源
  • 换回默认源
CDH 6.3.2 升级 Hive 2.3.9CDH6.3.2升级Zookeeper3.4.14
Loading...