【问题标题】:ROS Melodic python versions conflict (--unmet dependencies)ROS Melodic python版本冲突(--unmet dependencies)
【发布时间】:2021-04-25 17:50:58
【问题描述】:

我的 Ubuntu 18.04 上安装了 ROS-Melodic。它默认带有python2.7。我错误地使用以下步骤安装了python3.8 -

wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar xzf Python-3.8.0
cd Python-3.8.0
sudo ./configure --enable-optimizations
sudo make altinstall
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
sudo make altinstall

之后,无论我在终端上安装或更新什么,都会出现未满足的依赖项错误 -

$ sudo apt-get update && sudo apt-get upgrade
Hit:1 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu bionic InRelease
Hit:2 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu bionic-updates InRelease
Hit:3 https://download.docker.com/linux/ubuntu bionic InRelease                    
Hit:4 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu bionic-backports InRelease
Hit:5 http://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu bionic-security InRelease
Hit:6 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease              
Hit:7 http://dl.google.com/linux/chrome/deb stable InRelease                       
Hit:8 http://dl.winehq.org/wine-builds/ubuntu bionic InRelease                     
Hit:9 http://ppa.launchpad.net/fingerprint/fingerprint-gui/ubuntu bionic InRelease 
Hit:10 https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04 ./ InRelease
Hit:11 http://ppa.launchpad.net/micahflee/ppa/ubuntu bionic InRelease              
Hit:12 http://ppa.launchpad.net/openshot.developers/ppa/ubuntu bionic InRelease    
Hit:13 http://packages.ros.org/ros/ubuntu bionic InRelease                         
Hit:14 http://wiki.jderobot.org/apt bionic InRelease                     
Reading package lists... Done                       
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
bzr : Depends: python:any
cython : Depends: python (< 2.8) but 3.8.0-1 is installed
      Depends: python:any (< 2.8)
      Depends: python:any (>= 2.7.5-5~)
googletest : Depends: python:any
libboost-mpi-python1.65.1 : Depends: python (< 2.8) but 3.8.0-1 is installed
                         Depends: python:any (< 2.8)
                         Depends: python:any (>= 2.7.5-5~)
mercurial : Depends: python (< 2.8) but 3.8.0-1 is installed
         Depends: python:any (< 2.8)
         Depends: python:any (>= 2.7~)
mercurial-common : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
python-all : Depends: python (= 2.7.15~rc1-1) but 3.8.0-1 is installed
python-all-dev : Depends: python (= 2.7.15~rc1-1) but 3.8.0-1 is installed
python-asn1crypto : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
python-attr : Depends: python:any (< 2.8)
           Depends: python:any (>= 2.7.5-5~)
python-autobahn : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
python-automat : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
python-backports.functools-lru-cache : Depends: python:any (< 2.8)
                                    Depends: python:any (>= 2.7.5-5~)
python-bzrlib : Depends: python (< 2.8) but 3.8.0-1 is installed
             Depends: python:any (>= 2.6.6-7~)
python-cairo : Depends: python (< 2.8) but 3.8.0-1 is installed
            Depends: python:any (< 2.8)
            Depends: python:any (>= 2.7.5-5~)
python-catkin-pkg : Depends: python (< 2.8) but 3.8.0-1 is installed
python-catkin-pkg-modules : Depends: python (< 2.8) but 3.8.0-1 is installed
                         Depends: python:any (>= 2.6.6-7~)
python-cbor : Depends: python (< 2.8) but 3.8.0-1 is installed
           Depends: python:any (< 2.8)
           Depends: python:any (>= 2.7.5-5~)
python-cffi-backend : Depends: python (< 2.8) but 3.8.0-1 is installed
                   Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7~)
python-chardet : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
python-click : Depends: python:any (< 2.8)
            Depends: python:any (>= 2.7.5-5~)
python-colorama : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
python-concurrent.futures : Depends: python:any (< 2.8)
                         Depends: python:any (>= 2.7.5-5~)
python-configobj : Depends: python (< 2.8) but 3.8.0-1 is installed
python-constantly : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
python-crypto : Depends: python (< 2.8) but 3.8.0-1 is installed
             Depends: python:any (< 2.8)
             Depends: python:any (>= 2.7.5-5~)
python-cryptography : Depends: python (< 2.8) but 3.8.0-1 is installed
                   Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
python-cycler : Depends: python:any (< 2.8)
             Depends: python:any (>= 2.7.5-5~)
python-dateutil : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
python-dbus : Depends: python (< 2.8) but 3.8.0-1 is installed
           Depends: python:any (< 2.8)
           Depends: python:any (>= 2.7.5-5~)
python-defusedxml : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
python-dev : Depends: python (= 2.7.15~rc1-1) but 3.8.0-1 is installed
python-docutils : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
python-empy : Depends: python:any (< 2.8)
           Depends: python:any (>= 2.7.5-5~)
python-enum34 : Depends: python:any (< 2.8)
             Depends: python:any (>= 2.7.5-5~)
python-gi : Depends: python (< 2.8) but 3.8.0-1 is installed
         Depends: python:any (< 2.8)
         Depends: python:any (>= 2.7.5-5~)
python-gnupg : Depends: python:any (< 2.8)
            Depends: python:any (>= 2.7.5-5~)
python-gobject-2 : Depends: python (< 2.8) but 3.8.0-1 is installed
                Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
python-gtk2 : Depends: python (< 2.8) but 3.8.0-1 is installed
           Depends: python:any (>= 2.6.6-7~)
python-httplib2 : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
python-hyperlink : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
python-idna : Depends: python:any (< 2.8)
           Depends: python:any (>= 2.7.5-5~)
python-incremental : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
python-ipaddress : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
python-keyring : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
python-keyrings.alt : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
python-launchpadlib : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
python-lazr.restfulclient : Depends: python:any (< 2.8)
                         Depends: python:any (>= 2.7.5-5~)
python-lazr.uri : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
python-yaml : Depends: python (< 2.8) but 3.8.0-1 is installed
           Depends: python:any (< 2.8)
           Depends: python:any (>= 2.7.5-5~)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

关于如何解决这个 python 版本冲突的任何想法?非常感谢任何帮助。

【问题讨论】:

    标签: python ubuntu-18.04 ros dpkg


    【解决方案1】:

    有时会发生在为 python3 安装 ros 依赖项时,一些原始 ros 包会被删除。 通常,终端在删除它们之前会提示“以下软件包将被删除”。但大多数人在安装前不会注意到提示而错过了。

    再次运行ROS的安装命令,解决方法如下。

    sudo apt-get install ros-melodic-desktop-full --fix-missing
    

    您可以在使用python3和ROS自带的python2.7时尝试以下命令。

    sudo apt-get install python3-rospkg*
    sudo apt-get update --fix-missing
    sudo dpkg --configure -a
    sudo apt-get install -f
    sudo apt update
    
    # install ros again as some packages are removed while installing python3-rospkg*
    sudo apt-get install ros-melodic-desktop-full --fix-missing
    

    【讨论】:

    • 感谢@SujithRKumar 的回复。我没有尝试将 ros-melodic 从 python2 迁移到 python3。我试图通过重新安装 python3 来卸载它 [这里] [1] 但这对我来说不是合适的答案,因为我已经使用 python2.7 配置了 ros-melodic pkgs。这就是为什么这一切的原因。我通过从 update-alternatives 中删除 python3.8,为默认 python3.6 创建 python3 符号链接并运行 update-manager 来解决它,它允许运行 partial-upgrade (删除所有 ros melodic pkgs,python链接到 ros 的软件包)。 [1]:askubuntu.com/a/1206924/1210885
    • 现在我的系统工作正常,我不得不重新安装 ros melodic。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多