ubuntu20.04中rosdep update超时
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
ubuntu20.04中rosdep update超时
问题
解决办法
- 修改DNS
常规的方法是修改“/etc/hosts”文件把raw.githubusercontent.com
服务器的ip地址注册到里边。
尝试过后失败
- 资源代理
网站https://ghproxy.com/
支持github的资源代理可以用此代理加速rosdep对Github的访问进而解决rosdep update失败问题。我们要在rosdep的若干个脚本文件中把 https://ghproxy.com/
添加到相应URL前。该方法参考博客
尝试过后失败
- 将文件下载到本地成功
该方法核心思想就是将难以访问的文件通过一定办法保存到本地然后直接访问本地文件。
- 克隆需要用到的文件仓库
git clone https://github.com/ros/rosdistro.git
我把该仓库克隆到了/etc/ros
目录下后面会使用到该地址
- 修改文件1
/usr/lib/python3/dist-packages/rosdep2/rep3.py
注该文件路径是在ubuntu20.04下的路径如果是18.04则python3改为python2.7
修改该文件中以下代码中的路径
# REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'
REP3_TARGETS_URL = 'file:///etc/ros/rosdistro/releases/targets.yaml'
- 修改文件2
/usr/lib/python3/dist-packages/rosdistro/__init__.py
修改该文件中以下代码中的路径
# DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
DEFAULT_INDEX_URL = 'file:///etc/ros/rosdistro/index-v4.yaml'
- 修改文件3
/etc/ros/rosdep/sources.list.d/20-default.list
修改该文件中以下代码中的路径
# os-specific listings first
yaml file:///etc/ros/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///etc/ros/rosdistro/rosdep/base.yaml
yaml file:///etc/ros/rosdistro/rosdep/python.yaml
yaml file:///etc/ros/rosdistro/rosdep/ruby.yaml
gbpdistro file:///etc/ros/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
注意的是yaml file://
表示固定格式/etc/ros..
表示文件目录所以是yaml file:///
- 最后执行命令
rosdep update
成功