CentOS 7安装Python 2.6(与已有版本共存)

Posted mwcloud

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7安装Python 2.6(与已有版本共存)相关的知识,希望对你有一定的参考价值。

1. 安装需要用到的包

yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget

2. 下载 Python 2.6.8 版本

wget https://www.python.org/ftp/python/2.6.8/Python-2.6.8.tgz

3. 解压文件

tar -xzvf Python-2.6.8.tgz

4. 进入解压后文件的目录

cd Python-2.6.8

5. 配置安装信息.

./configure --prefix=/opt/module/python2.6

6. 编译文件

make

(若失败提示:configure: error: no acceptable C compiler found in $PATH

安装GCC:yum install gcc)

7. 安装编译好的文件

make altinstall      # 使用 altinstall 安装, 不影响其他 Python 版本

8. 设置软链接, 方便随时切换 Python 版本

ln -s /opt/module/python2.6/bin/python2.6 /usr/bin/python2.6

参考:https://blog.csdn.net/lyq19870515/article/details/80449386

以上是关于CentOS 7安装Python 2.6(与已有版本共存)的主要内容,如果未能解决你的问题,请参考以下文章

CentOS python 2.6 升级到 python 2.7

Centos将python 2.6 升级到 2.7

CentOS6.8 安装python2.7,pip以及yum

centos7安装与配置ansible

centos7安装与使用ansible

ansible安装