首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ubuntu18.04上无法安装的python2包问题

Ubuntu18.04上无法安装的python2包问题
EN

Ask Ubuntu用户
提问于 2020-06-25 00:33:27
回答 2查看 4.3K关注 0票数 5

Final更新

类似的问题也被报道为这里

话语公告:启用ros测试存储库的构建/CI失败?

Update2 2

事实上,在我的例子中,ROS旋律的安装最终失败了:

代码语言:javascript
复制
Errors were encountered while processing:
 /tmp/apt-dpkg-install-lRVV2P/0767-python-catkin-pkg-modules_0.4.22-1_all.deb
 /tmp/apt-dpkg-install-lRVV2P/0794-python-rospkg-modules_1.2.8-1_all.deb
 /tmp/apt-dpkg-install-lRVV2P/0796-python-rosdistro-modules_0.8.2-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

更多的日志:

代码语言:javascript
复制
Selecting previously unselected package python-catkin-pkg-modules.
Preparing to unpack .../0767-python-catkin-pkg-modules_0.4.22-1_all.deb ...
Unpacking python-catkin-pkg-modules (0.4.22-1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-lRVV2P/0767-python-catkin-pkg-modules_0.4.22-1_all.deb (--unpack):
 trying to overwrite '/usr/lib/python2.7/dist-packages/catkin_pkg/__init__.py', which is also in package python-catkin-pkg 0.3.9-1
代码语言:javascript
复制
Selecting previously unselected package python-rospkg-modules.
Preparing to unpack .../0794-python-rospkg-modules_1.2.8-1_all.deb ...
Unpacking python-rospkg-modules (1.2.8-1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-lRVV2P/0794-python-rospkg-modules_1.2.8-1_all.deb (--unpack):
 trying to overwrite '/usr/lib/python2.7/dist-packages/rospkg/__init__.py', which is also in package python-rospkg 1.1.4-1
代码语言:javascript
复制
Selecting previously unselected package python-rosdistro-modules.
Preparing to unpack .../0796-python-rosdistro-modules_0.8.2-1_all.deb ...
Unpacking python-rosdistro-modules (0.8.2-1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-lRVV2P/0796-python-rosdistro-modules_0.8.2-1_all.deb (--unpack):
 trying to overwrite '/usr/lib/python2.7/dist-packages/rosdistro/__init__.py', which is also in package python-rosdistro 0.6.6-1

<#>更新

有缺陷的时候:

代码语言:javascript
复制
The following packages have unmet dependencies:
 python-rosinstall-generator : Depends: python-catkin-pkg (>= 0.1.28) but it is not going to be installed
                               Depends: python-pkg-resources but it is not going to be installed
                               Depends: python-rosdistro (>= 0.7.3) but it is not going to be installed
                               Depends: python-rospkg but it is not going to be installed
                               Depends: python-yaml but it is not going to be installed
                               Depends: python2 (< 2.8) but it is not installable
                               Depends: python2 (>= 2.7) but it is not installable
                               Depends: python2:any (>= 2.6.6-7~) but it is not installable
E: Unable to correct problems, you have held broken packages.
代码语言:javascript
复制
apt-cache policy python-rosinstall-generator
python-rosinstall-generator:
  Installed: (none)
  Candidate: 0.1.20-1
  Version table:
     0.1.20-1 500
        500 http://packages.ros.org/ros/ubuntu bionic/main amd64 Packages
        500 http://packages.ros.org/ros/ubuntu bionic/main i386 Packages
     0.1.13-3 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu bionic/universe i386 Packages
代码语言:javascript
复制
apt-cache policy python3-rosinstall-generator
python3-rosinstall-generator:
  Installed: (none)
  Candidate: 0.1.20-1
  Version table:
     0.1.20-1 500
        500 http://packages.ros.org/ros/ubuntu bionic/main amd64 Packages
        500 http://packages.ros.org/ros/ubuntu bionic/main i386 Packages
     0.1.13-3 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu bionic/universe i386 Packages

我有一些问题要在Ubuntu18.04上用python-rosinstall-generator安装以下软件包apt

代码语言:javascript
复制
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-rosinstall-generator : Depends: python2 (< 2.8) but it is not installable
                               Depends: python2 (>= 2.7) but it is not installable
                               Depends: python2:any (>= 2.6.6-7~) but it is not installable
E: Unable to correct problems, you have held broken packages.

由于我使用的是Docker,所以我有一个旧映像,其中python-rosinstall-generator已经成功地安装在apt install python-rosinstall-generator上:

代码语言:javascript
复制
apt-cache depends python-rosinstall-generator
python-rosinstall-generator
  Depends: python
  Depends: python
  Depends: python-catkin-pkg
  Depends: python-pkg-resources
  Depends: python-rosdistro
  Depends: python-rospkg
  Depends: python-yaml
  Depends: 
    python:i386
    python
  Depends: 
    libpython2.7-stdlib
  Conflicts: python3-rosinstall-generator

在Docker中执行apt update之后,它现在给出:

代码语言:javascript
复制
apt-cache depends python-rosinstall-generator
python-rosinstall-generator
  Depends: python-catkin-pkg
  Depends: python-pkg-resources
  Depends: python-rosdistro
  Depends: python-rospkg
  Depends: python-yaml
  Depends: 
  Depends: 
  Depends: 
  Depends: 
    libpython2.7-stdlib
  Conflicts: python3-rosinstall-generator

无法安装python2包:

代码语言:javascript
复制
apt install python2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package python2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python2' has no installation candidate

最近的更新似乎破坏了一些东西,并引入了一个python2包依赖项。

<#>dockerfile

代码语言:javascript
复制
FROM ubuntu:18.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install --yes \
    build-essential \
    software-properties-common \
    pkg-config \
    cmake \
    g++

RUN add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"

RUN echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list
RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
RUN apt-get update && apt-get install --yes python-rosinstall-generator
EN

回答 2

Ask Ubuntu用户

回答已采纳

发布于 2020-06-25 08:17:22

看起来,packages.ros.org存储库提供了与Ubuntu18.04LTS不兼容的python3-rosinstall-generator包。

使用没有这种存储库的Dockerfile创建容器是成功的:

代码语言:javascript
复制
FROM ubuntu:18.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install --yes \
    build-essential \
    software-properties-common \
    pkg-config \
    cmake \
    g++

RUN apt-get update && apt-get install --yes python-rosinstall-generator

但是使用原始的Dockerfile成功地结束了ros-melodic-desktop-full的安装。

票数 2
EN

Ask Ubuntu用户

发布于 2020-06-25 03:46:51

解决此问题的一种方法可能是使用安装它。由于您将python2用于ROS,因此只需尝试以下操作:

代码语言:javascript
复制
sudo apt install python-pip
sudo pip install -U rosdep rosinstall_generator vcstool rosinstall

这对我来说很管用。我希望这能帮到你。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1253523

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档