报错原因:20-default.list无法下载因网络限制无法下载。
在运行 “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.
刚开始以为是自己网络问题,于是换成网线、其他无线试了好多次,还是显示同样的错误。
可能的解决方法:
(1)ca-certificates问题,证书不对,重新安装证书,运行命令如下:
sudo apt-get install ca-certificates
然而,我尝试了这个方法之后,并不行,还是显示同样的错误。说明我的证书没问题。接着用其他方法。
(2)系统时间同步问题,需要同步系统时间。运行以下命令:
sudo apt-get install ntpdate
sudo ntpdate cn.pool.ntp.org
sudo hwclock --systohc
然而。。。同样没用,还是显示同样的报错。继续尝试别的方法。
(3)ssl certs问题。运行以下命令:
sudo c_rehash /etc/ssl/certs
sudo -E rosdep init
However, it doesn’t work for me…again.
(4)python-rosdep问题
sudo apt-get install python-rosdep
笑而不语,继续默默转向其他方法。
(5)简单粗暴(然而对我电脑是有效的),请直接在/etc目录下新建/ros/rosdep/sources.list.d/20-default.list文件,下载地址:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/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
至此,已解决20-default.list无法下载的问题。开始下一步 “rosdep update”。
报错原因:下载超时,出现 time out 或 connect refuse,带选择方法如下:
(1)将20-default.list中所有raw.githubusercontent.com改为raw.github.com,得到如下最终文档:
#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
再次执行:rosdep update
(2)修改配置文件:/etc/resolv.conf 中的nameserver,内容如下:
sudo gedit /etc/resolv.conf
nameserver 8.8.8.8 #google域名服务器
nameserver 8.8.4.4 #google域名服务器
OK,我在尝试该方法之后,就可以成功运行 rosdep update 命令了。
如果还不行,可以继续尝试方法(3):
(3)timeout设置大点:
分别更改 /usr/lib/python2.7/distpackages/rosdep2/下的三个文件sources_list.py,gbpdistro_support.py,rep3.py中的DOWNLOAD_TIMEOUT = 15.0
成功升级,至此终于完成rosdep初始化,问题解决。
链接:https://pan.baidu.com/s/1rlBvebYo3MCPye9MfOELGA
提取码:ezuq