我正在尝试在Debian Jessie上安装ROS,当我运行sudo rosdep init
时,我遇到了错误。我正在关注的说明位于此URL(http://wiki.ros.org/kinetic/Installation/Source)。我正在从源代码安装,而不是因为一些库冲突而不是他们的回购。
运行sudo rosdep init
会产生以下输出。
Traceback (most recent call last):
File "/usr/bin/rosdep", line 3, in <module>
from rosdep2.main import rosdep_main
File "/usr/lib/python2.7/dist-packages/rosdep2/__init__.py", line 40, in <module>
from .installers import InstallerContext, Installer, \
File "/usr/lib/python2.7/dist-packages/rosdep2/installers.py", line 35, in <module>
from rospkg.os_detect import OsDetect
File "/usr/lib/python2.7/dist-packages/rospkg/__init__.py", line 42, in <module>
from .rospack import expand_to_packages, get_package_name, \
File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 35, in <module>
from xml.etree.cElementTree import ElementTree
File "/usr/lib/python2.7/xml/etree/cElementTree.py", line 3, in <module>
from _elementtree import *
ImportError: PyCapsule_Import could not import module "pyexpat"
我认为这是python根本找不到模块,所以我看看它所在的位置和python的路径,无济于事。
[jwerner5@rockhopper:~ ] $$ find / -name pyexpat*
/usr/include/python2.7/pyexpat.h
/usr/include/python3.4m/pyexpat.h
/usr/share/jython/Lib/pyexpat.py
/usr/share/jython/Lib/pyexpat$py.class
/usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so
>>> import sys
>>> print sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/wx-3.0-gtk2']
所以它在路上。我接下来运行strace -e open rosdep
只是确保它找到了文件。这是输出。它看起来像找到文件然后立即关闭它。这是相关的一点。
open("/usr/lib/python2.7/lib-tk/pyexpat.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/lib-tk/pyexpat.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so", O_RDONLY) = 9
open("/usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so", O_RDONLY|O_CLOEXEC) = 10
Traceback (most recent call last):
这个问题(ImportError: PyCapsule_Import could not import module "pyexpat")建议尝试重命名库或重新安装它。我尝试了这两件事,但都没有奏效。有没有人有任何想法?
编辑:自从发布以来,根据forax的说明,我尝试设置LD_LIBRARY_PATH,在python shell中手动导入pyexpat,然后查看ldd的输出为pyexpat。手动导入pyexpat
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyexpat
.
在pyexpat库上运行ldd
[jwerner5@rockhopper:~ ] $$ ldd /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007ffc069da000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f7214382000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7214165000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7213db9000)
/lib64/ld-linux-x86-64.so.2 (0x000055fe01ce4000)
答案 0 :(得分:0)
请尝试在python shell中手动导入并发布结果。
$ python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyexpat
>>>
并检查lib加载,应如下所示:
$ ldd /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007ffe82d10000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f6387386000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6387169000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6386dbd000)
/lib64/ld-linux-x86-64.so.2 (0x00005628bbd68000)