【ros】安装的时候执行 sudo rosdep init 遇到的问题 ‘ERROR: cannot download default sources list from...‘

一. 问题描述

以前安装ros,照着ros wiki的教程就ok了,之前重装了系统,得重装一下ros,但是遇到了一些问题。
在执行这两步骤的时候一直不成功

$ sudo rosdep init
$ rosdep update

然后出现这个错误:

sudo rosdep init ERROR: cannot download default sources list from

二. 解决办法

  • 在本地新建对应目录/etc/ros/rosdep/sources.list.d
sudo mkdir -p /etc/ros/rosdep/sources.list.d
  • 定位到该目录
 cd /etc/ros/rosdep/sources.list.d
  • 新建文件20-default.list
 sudo gedit 20-default.list
  • 将下面内容复制粘贴到新建打开的文档中
 # os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
  • 保存,关闭文件
  • 上面的一些列步骤,就相当于自己手动执行了sudo rosdep init

然后执行:

 rosdep update

此时你可能会成功,但是大概率会继续出现错误,比如我就出现了:),这个错误:

ERROR: unable to process source ...

解决办法:

sudo gedit /etc/resolv.conf

将原有的nameserver这一行注释,并添加以下两行:

nameserver 8.8.8.8 #google域名服务器
nameserver 8.8.4.4 #google域名服务器

保存退出,执行

sudo  apt-get update

再执行

rosdep update

然后就可以!nice
真的不容易…加油各位。

三. 新的问题和解决办法

在尝试了上面的解决办法之后还是不行,依然出现:

cannot download default sources list from: https://raw.githubusercontent.com/ros/rosdist

新的解决办法如下:

参考:ros 中 ERROR: cannot download default sources list from: https://raw.githubusercontent.com/ros/rosdist

  1. 赋予权限
sudo chmod 777 /etc
  1. 新建文件夹
sudo mkdir -p /etc/ros/rosdep/sources.list.d
  1. 打开网址

https://site.ip138.com

输入:raw.githubusercontent.com

随便挑选一个ip地址,我选的是香港的

  1. 打开文件
sudo gedit /etc/hosts

添加:刚刚的 ip 和 raw.githubusercontent.com,例如:

151.101.76.133 raw.githubusercontent.com

然后就可以继续操作了:

sudo rosdep init
rosdep update

又ok了。

  • 3
    点赞
  • 40
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值