如何修复“E:无法找到方法驱动程序/ usr / lib / apt / methods / http。”错误?

我尝试从终端更新我的包,这就是我得到的:

$ sudo apt-get update E: The method driver /usr/lib/apt/methods/http could not be found. E: The method driver /usr/lib/apt/methods/http could not be found. E: The method driver /usr/lib/apt/methods/http could not be found. E: The method driver /usr/lib/apt/methods/http could not be found. E: The method driver /usr/lib/apt/methods/http could not be found. 

这是什么意思? 我正在使用美国镜像我尝试使用主服务器用于镜像,我一直得到相同的结果是因为没有更新?

SirCharlo在这个问题的副本中说:

 sudo apt-get install apt-transport-https 

我尝试过它,它对我有用。

在我的情况下,找到.list文件中的所有源代码,例如:

 /etc/apt/sources.list /etc/apt/sources.list.d/nginx.list /etc/apt/sources.list.d/passenger.list 

即使您将其更改为http://,它也会强制使用https://列表中的某些来源,它将重定向到https://

解决方案是:

  1. 首先备份并删除https源
  2. 然后运行apt-get update
  3. 运行sudo apt-get install apt-transport-https
  4. 恢复https源

我的问题是/etc/apt/sources.list.d/opera-stable.list中的Opera浏览器,它写道:

 https//: 

但正确的是:

 https:// 

所以我这样修理线路:

 deb https://deb.opera.com/opera-stable/ stable non-free #Opera Browser (final releases) 

一切都解决了!

在新鲜的OrangePi图像上遇到同样的问题。 将https交换到http没有帮助。 最后,我创建了一个名为https的http符号链接,并且能够执行apt-get update。 安装的第一件事是apt-transport-https,而不是我重新运行更新。

我以前遇到过这个问题,在我的情况下,问题出现在/etc/apt/sources.list 。 确保没有引号''""

 deb "http://archive.canonical.com/ubuntu/ maverick partner (Source Code)" 

删除引号并将这些行更改为:

 deb http://archive.canonical.com/ubuntu/ maverick partner (Source Code) 

另外,正如@arhimed建议的那样,确保协议格式正确: http://

我的错误读取方法驱动程序/usr/lib/apt/methods/htttp ,在阅读此处并尝试所有产品后,当我注意到http有一个额外的t时,我就要放弃了。

我去做了这个:

 sudo -H gedit /etc/apt/source.list 

按Ctrl + F查找htttp所有实例。

删除额外的t

保存(两次以确保虫子接受它)

而中提琴,问题解决了。

猜猜这意味着我需要真正阅读错误消息,因为我一直在浏览它们。 学过的知识。 这不会再发生了

在/etc/apt/sources.list中查找https链接,检查同一链接的http链接是否有效。 如果它确实然后用https替换http并享受。 否则安装sudo apt-get install apt-transport-https,如上面的答案由DamiönlaBagh所述

我在这里的评论与OP的问题没有直接关系,但是因为这个页面在搜索E: The method driver /usr/lib/apt/methods/https could not be found.时出现谷歌的第一个结果E: The method driver /usr/lib/apt/methods/https could not be found. 这是我原本试图解决的错误,我正在添加一些帮助我解决问题的信息。

我碰巧在一个以太网网络上,该网络包含一个“防火墙”类型的设备,可以将未知计算机的网络流量重定向到一个网页,该网页要求您“同意”网络的服务条款,然后才能继续。 此页面恰好作为HTTPS页面提供。 因此,任何时候apt-get尝试连接,它最终都会在HTTPS站点上结束。 这也是为什么尝试安装apt-transport-https对我不起作用的原因。

我意识到这是一个非常老的线程,但在我的情况下,sources.list文件缺少“http”。 在地址。 (即http://kali.org vs http://http.kali.org )我在比较环境中的两个VM时发现了这一点。 不确定错误来自哪里,但替换它解决了问题。