我正在尝试安装ns3
,在此之前,我需要运行以下命令:
sudo apt install gir1.2-goocanvas-2.0 python-gi python-gi-cairo python-pygraphviz python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython ipython3
运行此命令后,出现此错误:
The following packages have unmet dependencies:
ipython : Depends: python-ipython (= 5.5.0-1) but it is not going to be installed
python-gi : Depends: python2 (< 2.8) but it is not going to be installed
Depends: python2 (>= 2.7~) but it is not going to be installed
Depends: python2:any (< 2.8)
Depends: python2:any (>= 2.7~)
python-gi-cairo : Depends: python-cairo (>= 1.11.1) but it is not going to be installed
Depends: python2 (< 2.8) but it is not going to be installed
Depends: python2 (>= 2.7~) but it is not going to be installed
Depends: python2:any (< 2.8)
Depends: python2:any (>= 2.7~)
E: Unable to correct problems, you have held broken packages.
我应该怎么做才能解决这个问题?
答案1
如果您所说的 ns3 是指 ns-3 网络模拟器,那么在他们的 wiki 上有一些关于在 Ubuntu 上安装它的指导。
它看起来像一长串的先决条件,但他们会发布您所需的确切命令。
https://www.nsnam.org/wiki/Installation#Ubuntu.2FDebian.2FMint
但是请编辑您的问题并指出您正在使用的 Ubuntu 版本,因为您需要执行的操作可能会有所不同。
此外,该网站还提到了 python(在旧版本中指的是 python2)和 python3。他们的软件正在过渡中。
答案2
首先,确保运行命令
sudo apt update
然后运行命令
sudo apt install gir1.2-goocanvas-2.0 python-gi python-gi-cairo python-pygraphviz python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython ipython3
如果出现同样的错误,则安装python-pip
并python3-pip
使用
sudo apt install python-pip python3-pip
完成后,ipython
通过安装pip
sudo -H pip install ipython
sudo -H pip3 install ipython
最后,运行
sudo apt install gir1.2-goocanvas-2.0 python-gi python-gi-cairo python-pygraphviz python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0