解决安装ROS时出现的sudo rosdep init错误问题
目前安装ROS时输入sudo rosdep init
的命令时,可能会出现以下的错误:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
解决办法
在https://github.com/ros/rosdistro下载好文件并解压,或者直接用git clone
下载。
- 第二步,修改包中
rosdep/source.list.d/20-default.list
。将该文件中的raw.githubusercontent.com
地址换成自己下载好的文件路径(注意需要加上file:
)。例如:
# os-specific listings first
yaml file:///home/robot/ros_files/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:home/robot/ros_files/rosdistro/rosdep/base.yaml
yaml file:///home/robot/ros_files/rosdistro/rosdep/python.yaml
yaml file:///home/robot/ros_files/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/robot/ros_files/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
DEFAULT_SOURCES_LIST_URL = 'file:///home/robot/ros_files/rosdistro/rosdep/sources.list.d/20-default.list'
同理修改/usr/lib/python2.7/dist-packages/rosdep2/rep3.py
为:
REP3_TARGETS_URL = 'file:///home/robot/ros_files/rosdistro/releases/targets.yaml'
修改/usr/lib/python2.7/dist-packages/rosdistro/__init__.py
DEFAULT_INDEX_URL = file:///home/robot/ros_files/rosdistro/index-v4.yaml'
def get_index_url():
注意:如果/usr/lib/python2.7文件夹中没有dist-packages文件夹,可以试着在/usr/lib/python2或者/usr/lib/python3等文件夹中找一下哪个文件夹里面有dist-packages,再修改相应的文件即可。
至此文件都已经修改完毕。可以试试sudo rosdep init
命令能不能成功,如果还是不能成功,请先检查一下自己的文件路径是否正确。祝君成功!
本文主要参考了:一页遮天。感谢前辈的工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)