Traceback (most recent call last):
File "/opt/ros/melodic/lib/teleop_twist_keyboard/teleop_twist_keyboard.py", line 7, in
import roslib; roslib.load_manifest('teleop_twist_keyboard')
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/launcher.py", line 64, in load_manifest
sys.path = _generate_python_path(package_name, _rospack) + sys.path
File "/opt/ros/melodic/lib/python2.7/dist-packages/roslib/launcher.py", line 97, in _generate_python_path
m = rospack.get_manifest(pkg)
File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 171, in get_manifest
return self._load_manifest(name)
File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 215, in _load_manifest
retval = self._manifests[name] = parse_manifest_file(self.get_path(name), self._manifest_name, rospack=self)
File "/usr/lib/python2.7/dist-packages/rospkg/manifest.py", line 414, in parse_manifest_file
_static_rosdep_view = init_rospack_interface()
File "/usr/lib/python2.7/dist-packages/rosdep2/rospack.py", line 60, in init_rospack_interface
lookup = _get_default_RosdepLookup(Options())
File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 136, in _get_default_RosdepLookup
verbose=options.verbose)
File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 601, in create_default
sources = load_cached_sources_list(sources_cache_dir=sources_cache_dir, verbose=verbose)
File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 563, in load_cached_sources_list
return parse_sources_data(cache_data, origin=cache_index, model=model)
File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 380, in parse_sources_data
sources.append(model(type_, url, tags, origin=origin))
File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 194, in create_model
with open(pickle_filepath, 'rb') as f:
IOError: [Errno 13] Permission denied: '/home/li/.ros/rosdep/sources.cache/21d71f75f817a611bdc9cf1ebd07be34d138da6b.pickle'
查了很多文章,最后发现并不是python版本问题,根据报错的最后一行,可以发现在/home/li/.ros/rosdep/sources.cache/文件夹下有文件无执行权限,cd 进入文件夹,将文件夹下所有文件给权限 sudo chmod 777 *。(我一开始以为只是一个文件无权限,但其实都没有)
然后就正常了,也不清楚为什么突然报错,之前用的时候还没事。