Ubuntu出现无法定位软件包
解决方法更换源
1.备份source.list,
sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
2.执行命令打开sources.list文件
sudo vim /etc/apt/sources.list
3.添加阿里云源
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
4.更新
sudo apt-get update
5.安装yum
sudo apt-get install yum
6.安装后测试命令
yum
7.如果测试yum是出现错误SyntaxError: invalid syntax
原因python环境连接到了python3上,但yum默认环境为python2
所以报错
8.解决方法将yum的python环境改为python2
vim /usr/bin/yum
按A插入将第一行的#! /usr/bin/python改为#! /usr/bin/python2
按esc退出输入:wq
立即生效
总结
搞了一晚上真是菜鸡他妈给菜鸡开门菜到家了