You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

安装PX4-Autopilot时遭遇依赖错误,寻求解决方案

安装PX4-Autopilot时遭遇依赖错误,寻求解决方案

嘿,看了你的问题,你是在运行PX4的Ubuntu安装脚本时碰到依赖版本冲突的问题了对吧?具体是libncurses5-dev和libncursesw5-dev需要特定旧版本的libtinfo6、libncurses-dev,但你的系统已经更新到了更高版本,还提示存在损坏的包。我给你整理了几个实用的步骤,应该能解决这个问题:

  • 第一步:先修复系统中损坏/锁定的包
    先把系统里的依赖状态理顺,运行以下命令清理冲突、修复损坏的包:

    sudo apt update
    sudo apt --fix-broken install
    sudo apt autoremove
    
  • 第二步:手动安装指定版本的依赖包
    PX4的脚本需要的是旧版本的依赖,我们可以从Ubuntu归档源下载对应包并安装(这里默认你的系统是amd64架构,如果是其他架构,需要替换包名里的amd64):

    # 下载所需的旧版本deb包
    wget http://archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo6_6.2-0ubuntu2.1_amd64.deb
    wget http://archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libncurses-dev_6.2-0ubuntu2.1_amd64.deb
    wget http://archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libncurses5-dev_6.2-0ubuntu2.1_amd64.deb
    wget http://archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libncursesw5-dev_6.2-0ubuntu2.1_amd64.deb
    

    按依赖顺序安装这些包:

    sudo dpkg -i libtinfo6_6.2-0ubuntu2.1_amd64.deb
    sudo dpkg -i libncurses-dev_6.2-0ubuntu2.1_amd64.deb
    sudo dpkg -i libncurses5-dev_6.2-0ubuntu2.1_amd64.deb libncursesw5-dev_6.2-0ubuntu2.1_amd64.deb
    

    如果安装时提示还有依赖缺失,再跑一次sudo apt --fix-broken install自动补全即可。

  • 第三步:锁定依赖版本防止自动更新
    为了避免后续系统更新替换掉这些旧版本依赖,把它们锁定:

    sudo apt-mark hold libtinfo6 libncurses-dev libncurses5-dev libncursesw5-dev
    
  • 第四步:重新运行PX4安装脚本
    现在回到PX4目录,重新执行安装脚本:

    cd /PX4-Autopilot
    ./Tools/setup/ubuntu.sh
    

你遇到的具体错误信息如下:

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:

libncurses5-dev : Depends: libtinfo6 (= 6.2-0ubuntu2.1) but 6.4+20240113-1ubuntu2 is to be installed

Depends: libncurses-dev (= 6.2-0ubuntu2.1) but 6.4+20240113-1ubuntu2 is to be installed

libncursesw5-dev : Depends: libtinfo6 (= 6.2-0ubuntu2.1) but 6.4+20240113-1ubuntu2 is to be installed

Depends: libncurses-dev (= 6.2-0ubuntu2.1) but 6.4+20240113-1ubuntu2 is to be installed

E: Unable to correct problems, you have held broken packages.

备注:内容来源于stack exchange,提问作者Fatih

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 08:58:14