在 CentOS 6 系统上安装最新版 Python3 软件包的 3 种方法
CentOS 克隆自 RHEL,无需付费即可使用。CentOS 是一个企业级标准的、前沿的操作系统,被超过 90% 的网络主机托管商采用,因为它提供了技术领先的服务器控制面板 cPanel/WHM。
该控制面板使得用户无需进入命令行即可通过其管理一切。
众所周知,RHEL 提供长期支持,出于稳定性考虑,不提供最新版本的软件包。
如果你想安装的最新版本软件包不在默认源中,你需要手动编译源码安装。但手动编译安装的方式有不小的风险,即如果出现新版本,无法升级手动安装的软件包;你不得不重新手动安装。
那么在这种情况下,安装最新版软件包的推荐方法和方案是什么呢?是的,可以通过为系统添加所需的第三方源来达到目的。
可供企业级 Linux 使用的第三方源有很多,但只有几个是 CentOS 社区推荐使用的,它们在很大程度上不修改基础软件包。
这几个推荐的源维护的很好,为 CentOS 提供大量补充软件包。
在本教程中,我们将向你展示,如何在 CentOS 6 操作系统上安装最新版本的 Python 3 软件包。
方法 1:使用 Software Collections 源 (SCL)
SCL 源目前由 CentOS SIG 维护,除了重新编译构建 Red Hat 的 Software Collections 外,还额外提供一些它们自己的软件包。
该源中包含不少程序的更高版本,可以在不改变原有旧版本程序包的情况下安装,使用时需要通过 scl 命令调用。
运行如下命令可以在 CentOS 上安装 SCL 源:
# yum install centos-release-scl
检查可用的 Python 3 版本:
# yum info rh-python35Loaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfile* epel: ewr.edge.kernel.org* remi-safe: mirror.team-cymru.comAvailable PackagesName : rh-python35Arch : x86_64Version : 2.0Release : 2.el6Size : 0.0Repo : installedFrom repo : centos-sclo-rhSummary : Package that installs rh-python35License : GPLv2+Description : This is the main package for rh-python35 Software Collection.
运行如下命令从 scl 源安装可用的最新版 python 3:
# yum install rh-python35
运行如下特殊的 scl 命令,在当前 shell 中启用安装的软件包:
# scl enable rh-python35 bash
运行如下命令检查安装的 python3 版本:
# python --versionPython 3.5.1
运行如下命令获取系统已安装的 SCL 软件包列表:
# scl -lrh-python35
方法 2:使用 EPEL 源 (Extra Packages for Enterprise Linux)
EPEL 是 Extra Packages for Enterprise Linux 的缩写,该源由 Fedora SIG (Special Interest Group)维护。
该 SIG 为企业级 Linux 创建、维护并管理了一系列高品质补充软件包,受益的企业级 Linux 发行版包括但不限于红帽企业级 Linux (RHEL)、 CentOS、 Scientific Linux (SL) 和 Oracle Linux (OL)等。
EPEL 通常基于 Fedora 对应代码提供软件包,不会与企业级 Linux 发行版中的基础软件包冲突或替换其中的软件包。
推荐阅读: 在 RHEL, CentOS, Oracle Linux 或 Scientific Linux 上安装启用 EPEL 源
EPEL 软件包位于 CentOS 的 Extra 源中,已经默认启用,故我们只需运行如下命令即可:
# yum install epel-release
检查可用的 python 3 版本:
# yum --disablerepo="*" --enablerepo="epel" info python34Loaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfile* epel: ewr.edge.kernel.orgAvailable PackagesName : python34Arch : x86_64Version : 3.4.5Release : 4.el6Size : 50 kRepo : epelSummary : Version 3 of the Python programming language aka Python 3000URL : http://www.python.org/License : PythonDescription : Python 3 is a new version of the language that is incompatible with the 2.x: line of releases. The language is mostly the same, but many details, especially: how built-in objects like dictionaries and strings work, have changed: considerably, and a lot of deprecated features have finally been removed.
运行如下命令从 EPEL 源安装可用的最新版 python 3 软件包:
# yum --disablerepo="*" --enablerepo="epel" install python34
默认情况下并不会安装 pip 和 setuptools,我们需要运行如下命令手动安装:
# curl -O https://bootstrap.pypa.io/get-pip.py% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed100 1603k 100 1603k 0 0 2633k 0 --:--:-- --:--:-- --:--:-- 4816k# /usr/bin/python3.4 get-pip.pyCollecting pipUsing cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whlCollecting setuptoolsDownloading https://files.pythonhosted.org/packages/8c/10/79282747f9169f21c053c562a0baa21815a8c7879be97abd930dbcf862e8/setuptools-39.1.0-py2.py3-none-any.whl (566kB)100% |████████████████████████████████| 573kB 4.0MB/sCollecting wheelDownloading https://files.pythonhosted.org/packages/1b/d2/22cde5ea9af055f81814f9f2545f5ed8a053eb749c08d186b369959189a8/wheel-0.31.0-py2.py3-none-any.whl (41kB)100% |████████████████████████████████| 51kB 8.0MB/sInstalling collected packages: pip, setuptools, wheelSuccessfully installed pip-10.0.1 setuptools-39.1.0 wheel-0.31.0
运行如下命令检查已安装的 python3 版本:
# python3 --versionPython 3.4.5
方法 3:使用 IUS 社区源
IUS 社区是 CentOS 社区批准的第三方 RPM 源,为企业级 Linux (RHEL 和 CentOS) 5、 6 和 7 版本提供最新上游版本的 PHP、 Python、 MySQL 等软件包。
IUS 社区源依赖于 EPEL 源,故我们需要先安装 EPEL 源,然后再安装 IUS 社区源。按照下面的步骤安装启用 EPEL 源和 IUS 社区源,利用该 RPM 系统安装软件包。
推荐阅读: 在 RHEL 或 CentOS 上安装启用 IUS 社区源
EPEL 软件包位于 CentOS 的 Extra 源中,已经默认启用,故我们只需运行如下命令即可:
# yum install epel-release
下载 IUS 社区源安装脚本:
# curl 'https://setup.ius.io/' -o setup-ius.sh% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed100 1914 100 1914 0 0 6563 0 --:--:-- --:--:-- --:--:-- 133k
安装启用 IUS 社区源:
# sh setup-ius.sh
检查可用的 python 3 版本:
# yum --enablerepo=ius info python36uLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfile* epel: ewr.edge.kernel.org* ius: mirror.team-cymru.com* remi-safe: mirror.team-cymru.comAvailable PackagesName : python36uArch : x86_64Version : 3.6.5Release : 1.ius.centos6Size : 55 kRepo : iusSummary : Interpreter of the Python programming languageURL : https://www.python.org/License : PythonDescription : Python is an accessible, high-level, dynamically typed, interpreted programming: language, designed with an emphasis on code readability.: It includes an extensive standard library, and has a vast ecosystem of: third-party libraries.:: The python36u package provides the "python3.6" executable: the reference: interpreter for the Python language, version 3.: The majority of its standard library is provided in the python36u-libs package,: which should be installed automatically along with python36u.: The remaining parts of the Python standard library are broken out into the: python36u-tkinter and python36u-test packages, which may need to be installed: separately.:: Documentation for Python is provided in the python36u-docs package.:: Packages containing additional libraries for Python are generally named with: the "python36u-" prefix.
运行如下命令从 IUS 源安装最新可用版本的 python 3 软件包:
# yum --enablerepo=ius install python36u
运行如下命令检查已安装的 python3 版本:
# python3.6 --versionPython 3.6.5
关注公众号
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
-
上一篇
Chrome 64 Beta版本3个振奋人心的新特性
5月25日, Chrome发布了64Beta版本,宣布了3个比较振奋人心的特性。 更强弹窗拦截 为了改善用户浏览网站的体验,新版本对弹窗拦截做了增强。主要包括欺骗性点击和 在网站中,经常会遇到有有点击播放视频,变成APP下载的情况,具体请参考微博的点击,和微信里点击视频播放的点击,新的chrome弹窗拦截支持了这种欺骗性点击的拦截。 2.多个弹窗被同时触发的情况,很多网站广告会故意设置一个关闭按钮,点击的时候不是关闭,反而是触发了多个弹窗,新的拦截已经能识别这种情况。 元素大小观察者 window一直能通过resize事件,检测到页面的大小变化,新的大小观察者能让开发者侦听到某个的元素的大小改变事件。示例代码如下: const ro = new ResizeObserver((entries) => { for (const entr
-
下一篇
动态规划法(二)找零钱问题
本次博客尝试以storyline的方式来写作,如有不足之处,还请多多包涵~~ 问题的诞生 我们故事的主人公叫做丁丁,他是一个十几岁的小男孩,机智聪颖,是某某杂货店的小学徒。在他生活的国度里,只流通面额为1,3,4的硬币。复杂这家店的店长,叫做老王,是个勤奋实干的中年人,每天都要跟钱打交道。 有一天,他心血来潮,叫住正在摆放货物的丁丁,对他说道:“丁丁,你不是学过计算机方面的算法吗?我这里正好有个问题,不知你能解答不?” 一听到算法,丁丁的眼睛里闪出光芒,这正是自己的兴趣所在。于是,他连忙凑到柜台,好奇地问题:“什么问题啊?” 老王也不多说废话,他知道丁丁的聪慧之处,直接了当地说道:“你看啊,每次顾客们买完东西付款后,我们都要找零给他们,我们这边所有的硬币(1,3,4)都是充足的,我想知道一共有多少种找零方式?比如说找零为4的话,就有4=1+1+1+1=3+1=1+3=4共4种方式。” 乍听到这个问题,丁丁有点蒙圈了,因为4的情况是简单的,但是随着找零的面额增加,数量的变化就没有什么规律了。他示意掌柜出去走走,掌柜也欣然同意。 递归?动态规划? 此时我们的主人...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- SpringBoot2全家桶,快速入门学习开发网站教程
- MySQL数据库在高并发下的优化方案
- SpringBoot2整合Thymeleaf,官方推荐html解决方案
- CentOS7设置SWAP分区,小内存服务器的救世主
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题
- CentOS关闭SELinux安全模块
- Dcoker安装(在线仓库),最新的服务器搭配容器使用
- CentOS8编译安装MySQL8.0.19

微信收款码
支付宝收款码