解决安装ROS时sudo rosdep init的时候出现错误问题

 sudo: rosdep:找不到命令

1、先安装这个依赖

sudo apt install ros-melodic-ros-base

安装完之后出现这个错误:

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.

方法一:

打开hosts文件

sudo gedit /etc/hosts

在文件末尾添加

151.101.84.133  raw.githubusercontent.com

保存后退出再尝试

方法二:

这个错误我每次重装ROS的时候都会遇到,我也尝试过很多种方法,方法一一开始是可以用的,可到最近却不行了,后来参考了https://www.ioiox.com/archives/62.html这篇博客,发现可能是被墙了,raw.githubusercontent.com这个地址根本连接不上的缘故,所以我尝试了这位博主的方法:
1.查询真实IP
通过IPAddress.com首页,输入raw.githubusercontent.com查询到真实IP地址

IPAddress.com网址:https://www.ipaddress.com/

在这里插入图片描述
真实IP地址如上图

2.打开Ubuntu终端,输入:

sudo gedit /etc/hosts

3.在之中添加:

199.232.96.133 raw.githubusercontent.com

在这里插入图片描述
保存之后再继续执行sudo rosdep init就行了。

古月居:https://www.guyuehome.com/12640

猜你喜欢

转载自blog.csdn.net/seniorc/article/details/112272824