首页 > 解决方案 > 仅使用 Python 3 安装 ROS 旋律且不会弄乱系统库?

问题描述

流程及问题说明:

我正在按照那里的安装指南:
http ://wiki.ros.org/melodic/Installation/Ubuntu

但:

  1. $ sudo apt-get install ros-melodic-desktop-full不起作用:

    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:
     ros-melodic-desktop-full : Depends: ros-melodic-perception but it is not going to be installed    
    E: Unable to correct problems, you have held broken packages.    
    

    -> 问题 1。

  2. $ sudo apt-get install ros-melodic-desktop-full似乎工作,但它需要安装一大堆包(602 MB) - 我有点期待。在详细查看这些包时,我可以看到:

    • 超过 190 个 ros-something-packages:好的

    • 一些新的库:好的

    • 超过 40 个python-<packages>(绝对是 Python 2 包):-> 问题 2.1

    • 超过 80 libboost-<something-system-libraries>: -> 问题 2.2

相关问题:

问题一:

你知道为什么吗?

问题 2.1:

如何强制使用这些包的 Python 3 版本?

问题 2.2:

出于其他目的,我从源代码构建提升(Building Boost from sources on Linux)。
因此,我担心如果我安装了所有这些依赖项的 ros,那么随附的boost系统库ros(都是 boost 版本1.65)会弄乱我对 boost 库的个性化安装(版本是1.68),尤其是当我想编译其他软件(我希望这些库只有一个版本;即最新的 1.68)。
有没有办法告诉ros使用这些已经安装的库(基本上在/usr/local/)?

一般信息:

我使用的是 Ubuntu 18.04:4.15.0-43-generic x86_64 GNU/Linux Python 3 版本是:3.6.7

标签: ubuntuboostros

解决方案


为了使 ROS 系统正常工作,它需要最低特定版本的依赖项。

您不能在安装中使用 python 3,因为所有工具都是使用 python 2.7+ 制作的,但是您可以通过更改ROS_PYTHON_VERSION为 3 来指定运行或编译包时要使用的 python 版本。

我认为您可以使用此答案将编译的源代码转换为.deb文件并安装它以防止 apt 干扰您的 boost 库


推荐阅读