报错原因: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
sudo c_rehash /etc/ssl/certs
sudo -E rosdep init
4)python-rosdep问题
sudo apt-get install python-rosdep
若以上方法全部无效,请直接在/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无法下载的问题。
报错原因:链接下载超时,出现 time out 或 connect refuse
将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
修改配置文件:
sudo gedit /etc/resolv.conf
nameserver 8.8.8.8 #google域名服务器
nameserver 8.8.4.4 #google域名服务器
timeout设置大点:
分别更改 /usr/lib/python2.7/distpackages/rosdep2/下的三个文件sources_list.py,gbpdistro_support.py,rep3.py中的DOWNLOAD_TIMEOUT = 15.0
rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Add distro "crystal"
Add distro "dashing"
Add distro "eloquent"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Add distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
updated cache in /home/eco/.ros/rosdep/sources.cache
成功升级,至此终于完成rosdep初始化,问题解决。
若问题未能顺利解决,需要在Linux系统下进行科学上网,从而一次性解决上述问题。