無法弄清楚 roslaunch 出了什麼問題

無法弄清楚 roslaunch 出了什麼問題

我確信我已經在我的 wsl 上正確安裝了 ROS(發行版是旋律的),並且我知道我已經遵循了每一步以便正確下載完整的軟體包,但使用命令列 roslaunch 或與 roslaunch 相關的任何內容只會讓我回到這則訊息

Command 'roslaunch' not found, but can be installed with:

sudo apt install python-roslaunch

如果我輸入命令列

sudo apt install python-roslaunch

然後它會引導我到

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:
 python-roslaunch : Depends: python-roslib but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

安裝 python-roslib 會導致我遇到另一個與上面類似的錯誤。我已經嘗試了一切。從重新安裝所有內容到觸摸 rootf 目錄中找到的文件,但到目前為止沒有任何效果。任何至少可以幫助我找出問題所在的事情都將不勝感激。

答案1

$ sudo apt-get update 
$ sudo apt-get upgrade

$ sudo apt-get update --fix-missing

$ sudo apt-get autoclean

$ apt-get clear cache

答案2

這些是修復you have held broken packages錯誤的一些快速且簡單的方法。

  • 開啟您的sources.list 檔案/etc/apt/sources.list並檢查是否沒有任何與您目前使用的Ubuntu 版本不同的Ubuntu 版本的軟體來源。如果您在sources.list中發現任何不正確的發布行,請使用開啟sources.list文件sudoedit /etc/apt/sources.list,透過在sources.list中新增一個字元註解掉sources.list中不正確的行#,儲存sources.list文件,然後運行sudo apt update以更新清單可用的軟體包。

  • 選擇修復損壞的包Synaptic 套件管理器中的選項。執行以下命令來安裝 Synaptic。

      sudo apt update  
      sudo apt upgrade   
      sudo apt install synaptic  
    

    開啟 Synaptic 並在 Synaptic 中選擇編輯->修復損壞的包然後重複編輯->修復損壞的包第二次。

    在 Synaptic 的左窗格中按一下自訂過濾器按鈕,在下面的螢幕截圖中由滑鼠遊標標記。從左上角的清單中選擇破碎的。中心窗格中將列出所有仍需要修復的損壞包。

在 Synaptic 中顯示損壞的包

Select the broken packages one at a time. Select a broken package, and then open the terminal and run <code>apt policy <b>&lt;package-name&gt;</b></code>. The results of this command will tell you if that broken package was installed from the default Ubuntu repositories or from some other source. If the broken package was installed from some other source, maybe that package can be removed along with its software source and replaced by a different version of the same package from the default Ubuntu repositories. Usually this means fixing a broken package by downgrading that package to an older version.
  • 如果您收到此錯誤訊息:

      Try 'apt-get -f install' with no packages (or specify a solution)  
    

    運行以下命令:

      sudo apt update  
      sudo apt upgrade   
      sudo apt-get -f install   
    
  • 手動刪除損壞的包。

  1. 找到您的包裹/var/lib/dpkg/info

         ls -l /var/lib/dpkg/info | grep <package>
    
  2. 將包資料夾移動到另一個位置。

         cd /tmp && sudo mkdir new-package-location  
         sudo mv /var/lib/dpkg/info/<package>.* /tmp/new-package-location/    
    
  3. 運行以下命令:

         sudo dpkg --remove --force-remove-reinstreq <package>  
    

如果所有這些方法都不起作用,則損壞的軟體包可能是由深深嵌入作業系統中的某些內容引起的,以至於這些方法對其沒有任何影響。尋找這種深深嵌入的「東西」的第一個明顯的地方是在/etc/apt/sources.list.檢查sources.list 檔案以查看它是否包含任何可能導致損壞的套件錯誤的非標準行。標準 Ubuntu 的sources.list 檔案看起來像中的sources.list 文件這個答案

從sources.list 中刪除可疑行的正確方法是透過在其前面新增一個字元來將其註解掉#。然後運行sudo apt update以刷新可用軟體列表。

相關內容