解决 rosdep 无法初始化问题
最好你的电脑可以走代理
在执行以下命令时:
sudo rosdep init
rosdep update
会报错:
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.
这是因为 GitHub 有时候会被国内网络“封锁”,所以采取手动创建的方式进行解决。
先确保你能够代理访问,然后打开链接:https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
在本地新建文件:
sudo mkdir -p /etc/ros/rosdep/sources.list.d
cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list
将上面打开网页中的内容复制粘贴到新建打开的文档中,并将所有 http://raw.githubusercontent.com
改为 http://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 初始化:
rosdep update
如果仍旧无法完成初始化,说明 GitHub 的域名被污染,无法访问。因此需要在配置文件里更改解析地址。
sudo gedit /etc/hosts
在文件最后添加:
151.101.84.133 raw.githubusercontent.com
保存文件后退出重试:
rosdep update
如果不行,就等一会再试,添加的这个 hosts 不是很稳定,有时候可以有时候不可以。
如果以上方法不行,那就使用 rosdepc 进行替代,以后把 rosdep 指令换成 rosdepc 即可。
sudo apt-get install python3-pip
sudo pip3 install rosdepc
sudo rosdepc init
rosdepc update
作者:xiaoaug
出处:https://www.cnblogs.com/xiaoaug/p/17790507.html
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
标签:
ROS
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix