https://blog.csdn.net/moveym/article/details/125569233
一、首先了解Linux系统下这两个命令的区别
yum:
属于:RedHat系列
常见系统有:Redhat、Centos、Fedora等
apt-get:
属于:Debian系列
常见系统:Debian、Ubuntu等
# 查看当前系统版本
cat /etc/redhat-release
网易镜像系统官网:http://mirrors.163.com/centos/7/os/x86_64/Packages/
可以修改需要的版本
# 下载yum相关依赖,前提创建目录,便于查找
# 创建存放目录
1 mkdir /usr/local/src/python
2 mkdir /usr/local/src/yum
# 下载yum依赖
cd /usr/local/src/yum # yum 目录
rpm -ivh --nodeps http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh --nodeps http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
rpm -ivh --nodeps http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
# 运行python -bash: python: command not found,yum 运行依赖需要python环境,所以python环境也要安装
# 下载python依赖
cd /usr/local/src/python # 进入目录
#wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-2.7.5-34.el7.x86_64.rpm
#wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
#wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-pycurl-7.19.0-17.el7.x86_64.rpm
#wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-devel-2.7.5-34.el7.x86_64.rpm
#wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-libs-2.7.5-34.el7.x86_64.rpm
#wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-urlgrabber-3.10-7.el7.noarch.rpm
#wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/rpm-python-4.11.3-17.el7.x86_64.rpm
# 安装python
1、rpm -ivh python-* rpm-python-*
出现安装包的依赖问题,此时如下解决即可:
warning: python-2.7.5-34.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
libcrypto.so.10()(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
libcrypto.so.10(OPENSSL_1.0.1)(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
libcrypto.so.10(OPENSSL_1.0.1_EC)(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
libcrypto.so.10(libcrypto.so.10)(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
libgdbm.so.4()(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
libnsl.so.1()(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
libnsl.so.1(GLIBC_2.2.5)(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
libreadline.so.6()(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
libssl.so.10()(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
libssl.so.10(libssl.so.10)(64bit) is needed by python-libs-2.7.5-34.el7.x86_64
liblua-5.1.so()(64bit) is needed by rpm-python-4.11.3-17.el7.x86_64
librpm.so.3()(64bit) is needed by rpm-python-4.11.3-17.el7.x86_64
librpmbuild.so.3()(64bit) is needed by rpm-python-4.11.3-17.el7.x86_64
librpmio.so.3()(64bit) is needed by rpm-python-4.11.3-17.el7.x86_64
librpmsign.so.1()(64bit) is needed by rpm-python-4.11.3-17.el7.x86_64
rpm = 4.11.3-17.el7 is needed by rpm-python-4.11.3-17.el7.x86_64
2、rpm -ivh python-* rpm-python-* --nodeps --force
--nodeps --force为不考虑依赖包,强制安装。
安装完后即可运行python:
# 安装yum
cd /usr/local/src/yum
rpm -ivh yum-* # 如果无法安装成功参考上面代码
运行yum,完美解决
————————————————
版权声明:本文为CSDN博主「Orange_ysen」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/moveym/article/details/125569233