ROS安装时,sudo rosdep init指令报错解决方案

问题描述

在安装ROS执行到sudo rosdep init命令时,由于国内防火墙的限制,导致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.

具体解决方法如下:

(1) 打开网址https://site.ip138.com/raw.Githubusercontent.com/,在打开界面输入无法访问的IP地址:raw.githubusercontent.com

(2)记录当前解析下的可访问IP地址,如上图中185.199.111.133

(3)配置本地hosts文件,将以下代码添加到hosts文件里,保存,然后重新执行

185.199.111.133  raw.githubusercontent.com
  • Windows系统的hosts文件位于:C:/Windows/System32/drives/etc目录下

  • Linux系统的hosts文件位于:/etc/hosts

至此,可解决由于防火墙外网访问限制导致的rosdep init失败问题。

阅读剩余
THE END