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.

 

解决方案

解决方案0x01

如果你正遇到这个问题,那么第一个解决方案就是,更换网络,你可以尝试使用你的手机热点,然后继续尝试以下指令,如果你成功了,那么你可以结束本文章的阅读,当然欢迎你继续阅读。

sudo rosdep init
rosdep update

解决方案0x02

该解决方案是针对由于以下两个无法正常访问,但可以ping通,于是修改hosts文件,加入以下两个网址的IP地址实现访问。

通过 https://site.ip138.com/查询网址对应的IP

sudo gedit /etc/hosts

199.232.28.133 raw.githubusercontent.com
151.101.228.133 raw.github.com

修改完成后,在终端执行

sudo rosdep init
rosdep update

解决方案0x03

如果使用解决方案0x01仍然无法解决你的问题,那么你可以尝试以下步骤,此解决方案的原理是基于手动完成sudo rosdep init的步骤,然后再通过rosdep update完成整个方案的实施。 步骤一:首先打开一个终端,执行以下指令创建root并切换至root用户

sudo passwd    //接着提示输入UNIX密码,输入你的用户密码即可
sudo su //或者su root 然后输入密码切换至root用户
sudo mkdir -p /etc/ros/rosdep/sources.list.d
cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list

步骤二:将以下内容复制进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

步骤三:执行以下指令

exit //退出root用户
rosdep update

如果你成功了,那么你可以结束本文章的阅读,当然欢迎你继续阅读。 但也许你会遇到如下图所示的问题,发现20-default.list中的地址都无法连接,此时你可以将20-default.list中的内容替换如下,即将raw.githubusercontent.com替换为raw.github.com后保存文件,在终端中执行

rosdep update

如果你成功了,那么你可以结束本文章的阅读,当然欢迎你继续阅读

# os-specific listings first
yaml https://raw.github.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

# generic
yaml https://raw.github.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.github.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.github.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.github.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 su
sudo gedit /etc/hosts

在hosts中添加以下内容并保存,在执行完后继续rosdep update

199.232.28.133 raw.githubusercontent.com
151.101.228.133 raw.github.com

解决方案 0x04-终极篇

如果上述步骤仍然不能解决你的问题,那么可以进行这最后的步骤。 执行以下指令,

sudo rosdep init

系统提示已经存在20-default.list(于解决方案0x02创建),那么下面就将该文件删除

sudo su
cd /etc/ros/rosdep/sources.list.d
sudo rm 20-default.list
exit

移除文件后打开新的终端

sudo rosdep init
rosdep update
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值