macOS High Sierra 10.13.4安装ROS Kinetic时rosdep初始化失败求助
解决macOS High Sierra下ROS Kinetic rosdep初始化失败的问题
我之前在Mac上部署ROS Kinetic时也踩过这个坑,本质就是网络限制导致没法直接拉取raw.githubusercontent.com上的源列表文件。给你一套亲测有效的手动解决流程:
手动创建默认源列表
既然自动下载走不通,咱们手动构建这个关键文件:
- 先创建rosdep需要的目录(如果系统还没生成的话):
sudo mkdir -p /etc/ros/rosdep/sources.list.d - 用终端文本编辑器新建
20-default.list文件,比如用nano操作最方便:sudo nano /etc/ros/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 gbdistro 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 - 保存并退出nano:按下
Ctrl+O,回车确认保存,再按Ctrl+X退出编辑器
完成rosdep更新
现在回到终端执行更新命令:
rosdep update
如果还是碰到个别资源下载失败的情况,大概率还是网络问题,可以试试这两个小技巧:
- 临时切换到手机热点网络,有时候移动网络的访问限制会宽松一些
- 如果你有可用的代理,可以在终端临时设置代理后再执行更新:
更新完成后,用下面的命令取消代理设置:export http_proxy=http://你的代理地址:端口号 export https_proxy=http://你的代理地址:端口号unset http_proxy https_proxy
额外提醒
ROS Kinetic在macOS High Sierra上的兼容性整体不错,后续如果碰到依赖缺失的问题,优先用Homebrew安装对应包,这是ROS官方推荐的Mac平台依赖管理方式。
内容的提问来源于stack exchange,提问作者frank jorsn
相关产品推荐
相关产品推荐

