ROS的roscore时出现The program 'roscore' is currently not installed. You can install it by typing: sudo

本文分享了在Python3环境下安装ROS遇到的问题及解决方案。作者最初在安装ROS时遇到roscore未安装成功的错误,尝试修改.bashrc文件无效。最终通过创建并激活Python2.7的虚拟环境,重新安装ROS,成功解决了问题,实现了roscore的正常运行。

在安装ROS的最后一步测试roscore是否安装成功否时The program 'roscore' is currently not installed. You can install it by typing: sudo apt install python-roslaunch

 然后试了大部分网友说的要在.bashrc文件里添加source /opt/XXXXX但是我试了好几次都不行,最后在一篇英文文档中看到原来时ros要在python2的环境中,在python3的环境中不太友好。

所以我在先创建了一个新的ros虚拟环境,conda create --name ros python=2.7

然后激活环境conda activate ros

然后重新安装ros

最后一步,roscore,终于出现了想要看到的内容啦,小乌龟也出现啦。。。

pilot@gen4x86:~$ sudo apt --fix-broken install Reading package lists... Done Building dependency tree... Done Reading state information... Done Correcting dependencies... Done The following additional packages will be installed: python3-catkin-pkg-modules python3-rospkg-modules The following NEW packages will be installed: python3-catkin-pkg-modules python3-rospkg-modules 0 upgraded, 2 newly installed, 0 to remove and 227 not upgraded. 3 not fully installed or removed. Need to get 0 B/67.4 kB of archives. After this operation, 393 kB of additional disk space will be used. Do you want to continue? [Y/n] Y (Reading database ... 221801 files and directories currently installed.) Preparing to unpack .../python3-catkin-pkg-modules_1.0.0-1_all.deb ... Unpacking python3-catkin-pkg-modules (1.0.0-1) ... dpkg: error processing archive /var/cache/apt/archives/python3-catkin-pkg-modules_1.0.0-1_all.deb (--unpack): trying to overwrite '/usr/lib/python3/dist-packages/catkin_pkg/__init__.py', which is also in package python3-catkin-pkg 0.4.24-2 Preparing to unpack .../python3-rospkg-modules_1.6.0-1_all.deb ... Unpacking python3-rospkg-modules (1.6.0-1) ... Errors were encountered while processing: /var/cache/apt/archives/python3-catkin-pkg-modules_1.0.0-1_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1) pilot@gen4x86:~$ pip install rosbags Defaulting to user installation because normal site-packages is not writeable Looking in indexes: http://10.85.128.137/pypi/voyager/stable/+simple/ Collecting rosbags Downloading http://10.85.128.137/pypi/root/official/%2Bf/2ce/27d8dc37f554f/rosbags-0.11.0-py3-none-any.whl (137 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 137.9/137.9 KB 909.7 kB/s eta 0:00:00 Requirement already satisfied: lz4 in ./.local/lib/python3.10/site-packages (from rosbags) (4.3.2) Collecting typing_extensions>=4.5 Downloading http://10.85.128.137/pypi/root/official/%2Bf/f0f/a19c6845758ab/typing_extensions-4.15.0-py3-none-any.whl (44 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.6/44.6 KB 980.0 kB/s eta 0:00:00 Collecting ruamel.yaml Downloading http://10.85.128.137/pypi/root/official/%2Bf/048/f26d64245bae5/ruamel.yaml-0.18.16-py3-none-any.whl (119 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 119.9/119.9 KB 1.0 MB/s eta 0:00:00 Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from rosbags) (1.21.5) Requirement already satisfied: zstandard in ./.local/lib/python3.10/site-packages (from rosbags) (0.18.0) Collecting ruamel.yaml.clib>=0.2.7 Downloading http://10.85.128.137/pypi/root/official/%2Bf/9bf/6b699223afe6c/ruamel.yaml.clib-0.2.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (721 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 721.3/721.3 KB 1.4 MB/s eta 0:00:00 Installing collected packages: typing_extensions, ruamel.yaml.clib, ruamel.yaml, rosbags Successfully installed rosbags-0.11.0 ruamel.yaml-0.18.16 ruamel.yaml.clib-0.2.14 typing_extensions-4.15.0 pilot@gen4x86:~$ python3 -c "from rosbags.rosbag import Reader; print('rosbags installed successfully')" Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'rosbags.rosbag'
最新发布
11-08
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值