python 导入错误:没有名为catkin_pkg. packages的模块

fsi0uk1n  于 2022-12-21  发布在  Python
关注(0)|答案(4)|浏览(294)

我在试着逃跑:-
roslaunch海龟机器人_凉亭海龟机器人_世界。启动
但我收到以下错误

Traceback (most recent call last):
  File "/opt/ros/kinetic/share/xacro/xacro.py", line 55, in <module>
    import xacro
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/xacro/__init__.py", line 42, in <module>
    from roslaunch import substitution_args
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 56, in <module>
    from .launch import ROSLaunchRunner
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/launch.py", line 55, in <module>
    from roslaunch.nodeprocess import create_master_process, create_node_process
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/nodeprocess.py", line 49, in <module>
    from roslaunch.node_args import create_local_process_args
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/node_args.py", line 53, in <module>
    import roslib.packages
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/__init__.py", line 54, in <module>
    import roslib.stacks
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/stacks.py", line 46, in <module>
    import roslib.packages
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/packages.py", line 49, in <module>
    from catkin.find_in_workspaces import find_in_workspaces as catkin_find
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/catkin/find_in_workspaces.py", line 36, in <module>

from catkin_pkg.packages import find_packages
ImportError: No module named catkin_pkg.packages
while processing /opt/ros/kinetic/share/turtlebot_gazebo/launch/includes/kobuki.launch.xml:
Invalid <param> tag: Cannot load command parameter [robot_description]: command [/opt/ros/kinetic/share/xacro/xacro.py '/opt/ros/kinetic/share/turtlebot_description/robots/kobuki_hexagons_asus_xtion_pro.urdf.xacro'] returned with code [1].
qacovj5a

qacovj5a1#

这对我很有效

pip install catkin_pkg
nfeuvbwi

nfeuvbwi2#

在Arch Linux上:在我的例子中,我安装了一个AUR包python2-catkin_pkg,这个包在/usr/lib/python2.7/site-packages安装了这个库。所以只要做一个从/opt/ros/kinetic/lib/python2.7/site-packages/usr/lib/python2.7/site-packages/catkin_pkg的符号链接。所以当你在/usr/lib/python2.7/site-packages目录下的时候做这个:

ln -s /usr/lib/python2.7/site-packages/catkin_pkg catkin_pkg
zyfwsgd6

zyfwsgd63#

可能是因为你的python版本太高了,就像我的例子一样。试着先使用系统默认的python。
返回/usr/bin/python3并将其用作默认值。

x7rlezfr

x7rlezfr4#

对于那些谁安装了康达,这里是解决方案:https://github.com/colcon/colcon-ros/issues/118#issuecomment-1355078266
您需要在环境中安装catkin_pkg。我使用的是conda,我必须安装catkin_pkg、empy和lark:

conda install -c conda-forge catkin_pkg empy lark

相关问题