ImportError:没有名为gobject的模块

时间:2019-04-23 15:56:47

标签: python linux ros

我安装了ros1并创建了一个catkin工作区。在src文件夹中,我克隆了一个ros程序包“ executive_smach_visualization”。但是,当我尝试使用以下命令运行它时,出现错误。

rosrun smach_viewer smach_viewer.py

跟踪:

wxversion 2.8 is not installed, installed versions are ['3.0-gtk3']
Traceback (most recent call last):
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py", line 77, in <module>
from smach_viewer import xdot
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/__init__.py", line 1, in <module>
import wxxdot
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/wxxdot.py", line 22, in <module>
from xdot import *
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/xdot.py", line 34, in <module>
import gobject
ImportError: No module named gobject

我已经尝试过以下操作:

1)使用pip安装了goobject

2)从git克隆gobject到catkin_ws,catkin_make和setup.bash的src文件夹中

可能是什么问题?如果我错过任何重要的意见,请告诉我。预先感谢。

2 个答案:

答案 0 :(得分:1)

如果有不同版本的ros,python等,则会发生此问题。

包装似乎有些过时了。

编辑:

下载软件包后,并在构建工作环境时,请使用:

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so

Please refer to 1.5 section (User configuration) of this guide

答案 1 :(得分:-1)

sudo apt-get install python-gobject