CentOS 7 - 安装Python 3
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的更多相关文章
- centos上安装python环境
1.安装python-pip 首先安装epel扩展源: yum -y install epel-release 更新完成之后,安装pip: yum -y install python- ...
- 在CentOS上安装Python
首先我们需要在服务器上安装一个比较新的 Python,CentOS 5.8 默认装的 Python 是 2.4.3. [root@nowamagic ~]# python -V Python 我们需要 ...
- centos下安装python
下载网址:http://ftp.gnu.org/gnu/gdb/ 1.编译python必须安装开发工具 # yum groupinstall "Development tools" ...
- centos 7安装python 3
linux-Centos7安装python3并与python2共存 1.查看是否已经安装Python CentOS 7.2 默认安装了python2.7.5 因为一些命令要用它比如yum 它使用的 ...
- centos下 安装python相关
centos 安装python相关 python3 https://blog.csdn.net/tanxiaob/article/details/78725301 yum -y install zli ...
- centos如何安装python库?
通过yum install安装,先解决yum不能安装python库的问题 yum install -y epel-release #先安装epel源,参考http://sharadchhetri. ...
- centos 7 安装python 3.x
首先 安装一些 可能需要的依赖: yum -y groupinstall "Development tools" yum -y install zlib-devel bzip2-d ...
- 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 > ...
- CentOS 6 安装 python and pip
yum update yum list python* //查看可安装python包 yum install python34.i686_64 wget https://bootstrap.p ...
- Centos下安装Python的问题汇总
Python下载地址(https://www.python.org/ftp/python/) 一.工具安装 1.Python的安装 tar vxf Python-2.7.13.tgz cd Pytho ...
随机推荐
- views视图
1.request.POST.get('.......') --radio 单选框 get()方法 从HTML中提取发过来的数据 1. 2. 3. 4. 2.request.POS ...
- 仿照addCleanup 在unittest中清理addSetupclass资源
addCleanup的用例这里不介绍了,可以看我的另一编文章: python unittest框架中addCleanup函数详解 但如果有下面这种场景,还是会遗留大批理资源 在setUpClass注入 ...
- vue工具 - vue/cli@3.xx 安装使用流程
mac安装记得npm前边加sudo 安装脚手架,用于生成目录 npm install -g @vue/cli 安装用于编译单个的.vue文件 npm install -g @vue/cli-servi ...
- 【牛客练习赛53】A-超越学姐爱字符串
// 题目地址:https://ac.nowcoder.com/acm/contest/1114/A /* 找规律(碰运气) n:1 = 2 n:2 = 3 n:3 = 5 n:4 = 8 ... d ...
- [BZ1925] [SDOI2010]地精部落
[BZ1925] [SDOI2010]地精部落 传送门 一道很有意思的DP题. 我们发现因为很难考虑每个排列中的数是否使用过,所以我们想到只维护相对关系. 当我们考虑新的一个位置时,给新的位置的数分配 ...
- linux复制文件夹、重命名文件夹、删除文件夹
linux中复制命令为cp(即copy缩写),重命名使用mv命令(即move缩写)来实现,删除命令为rm(即remove缩写). 如果操作对象是单个文件,复制和删除以及重命名很简单,如下: cp a. ...
- Oracle_PLSQL导出导入dmp文件
地址:F:\app\duling\product\11.2.0\dbhome_1\BIN\imp.exe ----------------------------------------------- ...
- springboot项目打包成jar/war包
springboot项目打包过程中包含第三方jar 开发IDE是IntelliJ IDEA,数据库是mysql,内置服务器tomcat. 打包步骤: 1. 确定项目调试运行没问题 2. 将第三方jar ...
- php Access-Control-Allow-Origin 解决跨域问题
第1种 在代码里面加 header信息(推荐) header("Access-Control-Allow-Origin: *"); //如果需要设置允许所有域名发起的跨域请求,可以 ...
- python入门之函数对象
目录 函数是第一类对象 1.函数名可以被引用 2.函数名可以当做参数传递 3.函数名可以当做返回值使用 4.函数名可以被当做容器类型的元素 函数是第一类对象 First-Class Object : ...