Enable Software Collections (SCL)

Software Collections, also known as SCL is a community project that allows you to build, install, and use multiple versions of software on the same system, without affecting system default packages. By enabling Software Collections you will gain access to the newer versions of programming languages and services which are not available in the core repositories.

CentOS 7 ships with Python 2.7.5 which is a critical part of the CentOS base system. SCL will allow you to install newer versions of python 3.x alongside the default python v2.7.5 so that system tools such as yum will continue to work properly.

In order to enable SCL we need to install the CentOS SCL release file. It is part of the CentOS extras repository and can be installed by running the following command: SCL : https://wiki.centos.org/zh/AdditionalResources/Repositories/SCL

sudo yum install centos-release-scl

Installing Python 3 on CentOS 7

Now that we have access to the SCL repository we can install any Python 3.x version we need. Currently, the following Python 3 collections are available:

  • Python 3.3
  • Python 3.4
  • Python 3.5
  • Python 3.6

In this tutorial we will install Python 3.6 which is the latest version available at the time of writing. To do so type the following command on your CentOS 7 terminal:

sudo yum install rh-python36

Using Python 3

After the package rh-python36 is installed, check the Python version by typing:

python --version

You will notice that Python 2.7 is the default Python version in your current shell.

To access Python 3.6 you need to launch a new shell instance using the Software Collection scl tool:

scl enable rh-python36 bash

What the command above does is calling the script /opt/rh/rh-python36/enable which changes the shell environment variables.

If you check the Python version again, you’ll notice that Python 3.6 is the default version in your current shell now.

It is important to point out that Python 3.6 is set as the default Python version only in this shell session. If you exit the session or open a new session from another terminal Python 2.7 will be the default Python version.

参考:

https://linuxize.com/post/how-to-install-python-3-on-centos-7/#installing-python-3-on-centos-7

https://www.centos.bz/2018/07/centos-7-%E5%AE%89%E8%A3%85-python-3-7/

CentOS 7 - 安装Python 3的更多相关文章

  1. centos上安装python环境

    1.安装python-pip ​ 首先安装epel扩展源: ​ yum -y install epel-release ​ 更新完成之后,安装pip: ​ yum -y install python- ...

  2. 在CentOS上安装Python

    首先我们需要在服务器上安装一个比较新的 Python,CentOS 5.8 默认装的 Python 是 2.4.3. [root@nowamagic ~]# python -V Python 我们需要 ...

  3. centos下安装python

    下载网址:http://ftp.gnu.org/gnu/gdb/ 1.编译python必须安装开发工具 # yum groupinstall "Development tools" ...

  4. centos 7安装python 3

    linux-Centos7安装python3并与python2共存   1.查看是否已经安装Python CentOS 7.2 默认安装了python2.7.5 因为一些命令要用它比如yum 它使用的 ...

  5. centos下 安装python相关

    centos 安装python相关 python3 https://blog.csdn.net/tanxiaob/article/details/78725301 yum -y install zli ...

  6. centos如何安装python库?

    通过yum install安装,先解决yum不能安装python库的问题 yum install -y  epel-release  #先安装epel源,参考http://sharadchhetri. ...

  7. centos 7 安装python 3.x

    首先 安装一些 可能需要的依赖: yum -y groupinstall "Development tools" yum -y install zlib-devel bzip2-d ...

  8. CentOS 6 安装 python 2.7 和 mod_wsgi 运行pyocr[tesseract]

    最新版本的tesseract-ocr 3.0.4 需要运行于python2.7版本以上,因此需要升级系统中默认的2.6版本python及Mod_WSGI 1,下载安装Python-2.7.10 > ...

  9. CentOS 6 安装 python and pip

    yum update yum list python*     //查看可安装python包 yum install python34.i686_64 wget https://bootstrap.p ...

  10. Centos下安装Python的问题汇总

    Python下载地址(https://www.python.org/ftp/python/) 一.工具安装 1.Python的安装 tar vxf Python-2.7.13.tgz cd Pytho ...

随机推荐

  1. HDU6223 && 2017沈阳ICPC: G. Infinite Fraction Path——特殊图&&暴力

    题意 给定一个数字串,每个位子都能向(i*i+1)%n的位子转移,输出在路径上.字典序最大的.长度为n的串($n \leq 150000$). 分析 先考虑一个暴力的方法,考虑暴力每个x,然后O(n) ...

  2. Spring Cloud微服务安全实战_3-4_API安全机制之认证

     认证:登录和认证是 两个概念,比如你两周.一个月,可能只登录了一次,但认证却是每次访问都要经过的步骤. 对于图中的认证不成功,也要继续处理,这个我觉得得看业务,比如管理系统,不登录就不让你访问,但对 ...

  3. C# 不包含 AsEnumerable 的定义

    引用 System.Data.DataSetExtensions 引用右键 ->添加引用 ->搜索 DataSetExtensions ->添加 注意版本

  4. BZOJ 5161: 最长上升子序列 状压dp+查分

    好神啊 ~ 打表程序: #include <cstdio> #include <cstring> #include <algorithm> #define N 14 ...

  5. VueCli3如何传递scss全局变量

    当我们尝试在一个scss文件中定义全局变量然后在.vue文件中使用的时候 哦豁,找不到变量,意料之外 我发现犯了一个错误,没导入,@import 'path/to/file.scss',不过这样的话, ...

  6. 第02组Beta冲刺(2/4)

    队名:十一个憨批 组长博客 作业博客 组长黄智 过去两天完成的任务:了解整个游戏的流程 GitHub签入记录 接下来的计划:继续完成游戏 还剩下哪些任务:完成游戏 燃尽图 遇到的困难:没有美术比较好的 ...

  7. svn Server authz 配置示例(文件夹权限配置)

    [aliases] [groups] admin = jiangzhehao technology = chenlei,liulei,xunzheng,qiaomingjie sales = chen ...

  8. python总结三

    1.线性表若采用链式存储结构的时候,要求内存中可用存储单位的地址是:连续或者不连续都可以 链式存储去找后继节点或者前驱节点是使用指针来实现的,不需要连续的内存,当然,也可以是连续的内存地址 2. 线性 ...

  9. [算法模板]Kruskal重构树

    [算法模板]Kruskal重构树 kruskal重构树是一个很常用的图论算法.主要用于解决u->v所有路径上最长边的最小值,就是找到\(u->v\)的一条路径,使路径上的最长边最小. 图片 ...

  10. CUDA C编程入门

    最近想用cuda来加速三维重建的算法,就先入门了一下cuda. CUDA C 编程 cuda c时对c/c++进行拓展后形成的变种,兼容c/c++语法,文件类型为'.cu',编译器为nvcc.cuda ...