sudo rosdep init 出现 ERROR: cannot download default sources list from:错误解决方法

sudo rosdep init 出现 ERROR: cannot download default sources list from:错误解决方法

关于安装ROS时出现的rosdep init错误

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.

解决办法

第一步

网上很多都说在/etc/hosts文件里加各种IP什么的,但是好像因为翻不了墙所以无法使用,最后试了好多种方法发现其中一个博主的方法是很可靠的。
先去百度连接下载文件,https://pan.baidu.com/s/1hKFJp_PQaela6i7RMOh5ZA,提取码:bryv
下载后将文件放入ubuntu的一个文件夹下。

第二步

修改这个包中rosdep/source.list.d/下的文件20-default.list,将这个文件中指向raw.githubusercontent.com的url地址全部修改为指向本地文件的地址,也就是该下载好的包的地址,可以进入rosdistro-master的文件夹中的rosdep中的sources.list.d中,在终端输入pwd查看路径,将路径复制,再修改20-default.list中的内容。

# os-specific listings first
yaml file:///home/xxx/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/xxx/rosdep/base.yaml
yaml file:///home/xxx/rosdep/python.yaml
yaml file:///home/xxx/rosdep/ruby.yaml
gbpdistro file:///home/xxx/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

注意是file://+路径;

第三步

进入/usr/lib/python2.7/dist-packages/rosdep2该文件夹下面的sources_list.py文件里面。而这个文件里面的代码则进行了访问raw.githubusercontent.com的操作,因此修改该默认url即可。以下是样例:

# default file to download with 'init' command in order to bootstrap
# rosdep
DEFAULT_SOURCES_LIST_URL = 'file:///home/xxx/rosdep/sources.list.d/20-default.list'

# seconds to wait before aborting download of rosdep data

第四步

修改以下两个文件里面的代码:

/usr/lib/python2.7/dist-packages/rosdep2/rep3.py
/usr/lib/python2.7/dist-packages/rosdistro/__init__.py

分别是

# location of targets file for processing gbpdistro files
REP3_TARGETS_URL = 'file:///home/xxx/releases/targets.yaml'
# seconds to wait before aborting download of gbpdistro data
# index information
DEFAULT_INDEX_URL = 'file:///home/xxx/index-v4.yaml'
def get_index_url():

这个文件是在rosdistro-master中,不需要进入子目录。

最后

然后进行sudo rosdep init :
激动人心的时刻来了:
在这里插入图片描述
成功!
参考原文连接https://zhuanlan.zhihu.com/p/107218921。

猜你喜欢

转载自blog.csdn.net/qq_43046763/article/details/116225256
今日推荐