![无法为 tor 安装 libevent](https://linux22.com/image/1090708/%E6%97%A0%E6%B3%95%E4%B8%BA%20tor%20%E5%AE%89%E8%A3%85%20libevent.png)
当我尝试安装 Tor 时,APT 抱怨libevent
:
$ sudo apt install tor
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
tor : Depends: libevent-2.1-6 (>= 2.0.10-stable) but it is not installable
我使用 Xubuntu 17.10 和 4.13.8 内核(4.13.0 导致我的电脑无法正常关闭)。我已将这些行添加到我的sources.list
deb http://deb.torproject.org/torproject.org artful main
deb http://deb.torproject.org/torproject.org zesty main
并且我尝试过apt update
,apt dist-upgrade
和apt autoremove
,但是都没有成功。
我如何安装所需版本libevent
?
更新:
当我尝试时sudo apt install libevent*
,出现以下错误:
libevent-2.1-6 is already the newest version (2.1.8-stable-4).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libevent1-dev : Conflicts: libevent-dev but 2.1.8-stable-4 is to be installed
E: Unable to correct problems, you have held broken packages.
答案1
我在 Ubuntu 17.10 上安装 tor 时遇到了同样的问题。原来是 apt 存储库版本的问题。
我的仓库是 16.04 (Xenial),而不是 17.10 (Artful) /etc/apt/sources.list
。更正后,一切正常。您可能需要再检查一下。
对于 17.10:
deb http://deb.torproject.org/torproject.org artful main
deb-src http://deb.torproject.org/torproject.org artful main
答案2
关于你的问题,下面是我解决问题的方法,我扩展了答案,因为在评论中一些用户要求这样做:
首先,你的错误是由于以前的安装(另一个软件包或更新)引起的问题,该tor
软件包不依赖于该库,我有 Xubuntu 17.10全新安装,下面是安装 tor 的输出:
如你所见,不需要libevent*
,但是你必须在安装 tor 之前修复该错误,我建议你尝试执行以下命令:
sudo apt install libevent-dev
sudo apt install libevent1-dev
sudo apt install libevent-2.1-6
下面是每个命令的输出截图(以这种方式安装依赖项会产生无错误):
sudo apt install libevent-dev
# 此库是必需的libevent-2.1.6
,Xubuntu 17.10 已经附带此版本的libevent
。
sudo apt install libevent1-dev
# 此库是必需的libevent-1.4-2
,但 Xubuntu 17.10 已经自带了libevent-2.1.6
这就是冲突的原因。我建议你安装它,如果你真的需要它,否则,使用最新版本。
最后一个命令是sudo apt install libevent-2.1-6
,这只是为了证明 Xubuntu 17.10 附带了这个库:
这些命令将以单独的方式逐个安装依赖项,从而避免冲突,因为如果您使用sudo apt install libevent*
,该命令就是导致错误消息的原因,见下图。您正在尝试同时安装同一个库的两个版本。
执行这些命令后,我没有收到任何错误,并且依赖项现在已正确安装。
最后,如果您愿意,可以执行sudo apt autoremove
,删除不需要的包。
希望有帮助,祝你好运!
答案3
您应该能够使用任何列出的镜像,只需在您的文件中添加一行,/etc/apt/sources.list
就像这样:
deb http://ftp.de.debian.org/debian stretch main