如何解决由于python问题而导致“ apt-get install”不起作用的问题

时间:2020-08-27 01:51:14

标签: python ubuntu ubuntu-16.04

我正在使用Ubuntu 16.04。我想使用“ apt-get install”安装与ROS相关的软件包,但无效。终端说如下。

$ sudo apt-get install ros-kinetic-libuvc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 bzr : Depends: python:any
 gimp : Depends: python:any (>= 2.6.6-7~)
 gyp : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 inkscape : Depends: python:any (>= 2.7.5-5~)
 ipython : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 libboost-mpi-python1.58.0 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                             Depends: python:any (>= 2.7.5-5~)
 libboost-python1.58-dev : Depends: python:any (< 2.8)
                           Depends: python:any (>= 2.7.5-5~)
 libglib2.0-dev : Depends: python:any (>= 2.6.6-7~)
 meld : Depends: python:any (< 2.8)
        Depends: python:any (>= 2.7.5-5~)
 mercurial : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 mercurial-common : Depends: python:any (< 2.8)
                    Depends: python:any (>= 2.7.5-5~)
 python-all : Depends: python (= 2.7.12-1~16.04) but 3.7.0-1 is to be installed
 python-all-dev : Depends: python (= 2.7.12-1~16.04) but 3.7.0-1 is to be installed
 python-amqp : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
 python-anyjson : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                  Depends: python:any (>= 2.7.1-0ubuntu2)
 python-apt : Depends: python (< 2.8) but 3.7.0-1 is to be installed
              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-billiard : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                   Depends: python:any (>= 2.7.5-5~)
 python-blinker : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
 python-bluez : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-bs4 : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
 python-bson : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
 python-bson-ext : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-bzrlib : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-cairo : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                Depends: python:any (>= 2.7.5-5~)
 python-catkin-pkg : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-catkin-pkg-modules : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-catkin-tools : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                       Depends: python:any (>= 2.7.1-0ubuntu2)
 python-celery : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
 python-cffi-backend : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-chardet : 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.7.0-1 is to be installed
 python-coverage : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-crypto : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                 Depends: python:any (>= 2.7.5-5~)
 python-cryptography : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                       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.7.0-1 is to be installed
               Depends: python:any (>= 2.7.5-5~)
 python-decorator : 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.12-1~16.04) but 3.7.0-1 is to be installed
 python-docutils : Depends: python:any (>= 2.7.5-5~)
                   Depends: python:any (< 2.8)
 python-ecdsa : 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-flask : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
 python-funcsigs : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-gi : Depends: python (< 2.8) but 3.7.0-1 is to be installed
             Depends: python:any (>= 2.7.5-5~)
 python-gi-cairo : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-git : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
 python-gitdb : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-glade2 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-gobject-2 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                    Depends: python:any (>= 2.7.5-5~)
 python-gpgme : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-gridfs : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
 python-gtk2 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-html5lib : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-httplib2 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-idna : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
 python-imaging : 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-itsdangerous : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-jinja2 : 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-kombu : 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-lxml : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-lz4 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-mailer : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
 python-markupsafe : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-matplotlib : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                     Depends: python:any (>= 2.7.5-5~)
 python-mechanize : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-memcache : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-mock : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
 python-mpi4py : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-msgpack : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                  Depends: python:any (>= 2.7.5-5~)
 python-netifaces : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-nose : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
 python-numpy : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                Depends: python:any (>= 2.7.5-5~)
 python-oauth : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
 python-opengl : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
                 Depends: python-ctypes
 python-openssl : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
 python-osrf-pycommon : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                        Depends: python:any (>= 2.7.1-0ubuntu2)
 python-pam : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-paramiko : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-pbr : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
 python-pexpect : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
 python-pil : Depends: python (< 2.8) but 3.7.0-1 is to be installed
              Depends: python:any (>= 2.7.5-5~)
 python-pil.imagetk : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                      Depends: python:any (>= 2.7.5-5~)
 python-pip : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
 python-pkg-resources : Depends: python:any (< 2.8)
                        Depends: python:any (>= 2.7.5-5~)
 python-psutil : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                 Depends: python:any (>= 2.7.5-5~)
 python-ptyprocess : Depends: python:any (< 2.8)
                     Depends: python:any (>= 2.7.5-5~)
 python-pyasn1 : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
 python-pyasn1-modules : Depends: python:any (< 2.8)
                         Depends: python:any (>= 2.7.5-5~)
 python-pyassimp : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pycurl : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                 Depends: python:any (>= 2.7.5-5~)
 python-pydot : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
 python-pygments : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-pyinotify : Depends: python:any (< 2.8)
                    Depends: python:any (>= 2.7.5-5~)
 python-pymongo : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
 python-pymongo-ext : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyparsing : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyqt5 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                Depends: python:any (>= 2.7.5-5~)
 python-pyqt5.qtopengl : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyqt5.qtsvg : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyqt5.qtwebkit : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.phonon : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtcore : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtdeclarative : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtgui : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qthelp : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtnetwork : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtopengl : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtscript : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtsql : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtsvg : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qttest : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtuitools : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtwebkit : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside.qtxml : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtconcurrent : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtcore : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                         Depends: python:any (>= 2.7.5-5~)
 python-pyside2.qtgui : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qthelp : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtnetwork : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtprintsupport : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtscript : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtsql : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtsvg : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qttest : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtuitools : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtwebkit : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtwebkitwidgets : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtwidgets : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtx11extras : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-pyside2.qtxml : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-qt4 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-rdkit : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                Depends: python:any (>= 2.7.5-5~)
 python-roman : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
 python-rosdep : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                 Depends: python:any (>= 2.7.1-0ubuntu2)
 python-rosdistro : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-rosdistro-modules : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-rosinstall : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                     Depends: python:any (>= 2.7.1-0ubuntu2)
 python-rosinstall-generator : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-rospkg : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-rospkg-modules : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-scipy : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                Depends: python:any (>= 2.7.5-5~)
 python-secretstorage : Depends: python:any (< 2.8)
                        Depends: python:any (>= 2.7.5-5~)
 python-serial : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-service-identity : Depends: python:any (< 2.8)
                           Depends: python:any (>= 2.7.5-5~)
 python-setuptools : Depends: python:any (< 2.8)
                     Depends: python:any (>= 2.7.5-5~)
 python-simplegeneric : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-simplejson : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                     Depends: python:any (>= 2.7.5-5~)
 python-sip : Depends: python (< 2.8) but 3.7.0-1 is to be installed
              Depends: python:any (>= 2.7.5-5~)
 python-sip-dev : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
 python-six : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
 python-skimage : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-skimage-lib : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-smmap : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-snappy : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-software-properties : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-talloc : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-tk : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-trollius : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-twisted : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7~)
 python-twisted-bin : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-twisted-core : Depends: python:any (< 2.8)
                       Depends: python:any (>= 2.7.5-5~)
 python-txaio : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
 python-tz : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-vcstools : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                   Depends: python:any (>= 2.7.1-0ubuntu2)
 python-vtk6 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
               Depends: python:any (>= 2.7.5-5~)
 python-wadllib : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-werkzeug : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-wheel : Depends: python:any (< 2.8)
                Depends: python:any (>= 2.7.5-5~)
 python-wstool : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                 Depends: python:any (>= 2.7.1-0ubuntu2)
 python-wxgtk3.0 : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                   Depends: python:any (>= 2.7.5-5~)
 python-wxversion : Depends: python:any (< 2.8)
                    Depends: python:any (>= 2.7.5-5~)
 python-yaml : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-zope.interface : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                         Depends: python:any (>= 2.7.5-5~)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

然后我尝试了“ apt-get -f install”,但是它也无法像下面那样工作。

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 bzr : Depends: python:any
 gimp : Depends: python:any (>= 2.6.6-7~)
 gyp : Depends: python (< 2.8) but 3.7.0-1 is installed
 inkscape : Depends: python:any (>= 2.7.5-5~)
 ipython : Depends: python (< 2.8) but 3.7.0-1 is installed
 libboost-mpi-python1.58.0 : Depends: python (< 2.8) but 3.7.0-1 is installed
                             Depends: python:any (>= 2.7.5-5~)
 libboost-python1.58-dev : Depends: python:any (< 2.8)
                           Depends: python:any (>= 2.7.5-5~)
 libglib2.0-dev : Depends: python:any (>= 2.6.6-7~)
 meld : Depends: python:any (< 2.8)
        Depends: python:any (>= 2.7.5-5~)
 mercurial : Depends: python (< 2.8) but 3.7.0-1 is installed
 mercurial-common : Depends: python:any (< 2.8)
                    Depends: python:any (>= 2.7.5-5~)
 .....
 python-zope.interface : Depends: python (< 2.8) but 3.7.0-1 is installed
                         Depends: python:any (>= 2.7.5-5~)
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

这些错误参考python 3.7。我从源代码安装了python 3.7。我已经从/ usr / bin和/ usr / local / bin中删除了python 3.7。但是,上述问题尚未解决。默认版本python 3.5仍然有效,因此我可以在计算机上使用python3。

有人可以建议我如何解决问题以及我的计算机吗?我需要避免清理操作系统。

1 个答案:

答案 0 :(得分:1)

Ubuntu依赖于所安装的特定版本的Python。在16.04中,/usr/bin/python必须为2.7,并且/usr/bin/python3必须为3.5。从源代码安装Python的make install步骤可能会覆盖这些文件。值得庆幸的是,它们只是符号链接,因此修复它应该很容易。以root用户身份:

# ln -sf python2.7 /usr/bin/python
# ln -sf python3.5 /usr/bin/python3

但是,如果您确实需要二进制文件,则可以使用上面的链接。只需选择您的体系结构,然后选择一面镜子。或使用apt download python python3(如果可行)。然后使用dpkg -i安装软件包。

然后将3.7安装回/usr/bin/python3.7,我相信您可以运行make altinstall