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

2023-05-16

文章目录

    • 一. 问题描述
    • 二. 解决办法
    • 三. 新的问题和解决办法

一. 问题描述

以前安装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了。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

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

随机推荐