Ubuntu18.04中解决ROS系统出现sudo rosdep init和rosdep update失败的方法(实测很有用!)

1、输入 sudo rosdep init 出现 sudo:rosdep: command not found的问题

解决方法:安装相应的包

sudo apt-get install python-rosdep

2、输入 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.

解决方法:删除之前安装的包

sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

3、输入 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 ERROR: error loading sources list: ('The read operation timed out',)

解决方法:修改一些函数。

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py

打开文件后安Ctrl+F查找download_rosdep_data函数,并在函数的第一行加入

url="https://ghproxy.com/"+url

用同样的方法修改/usr/lib/python2.7/dist-packages/rosdistro/__init__.py里面的DEFAULT_INDEX_URL

sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py

打开文件后安Ctrl+F查找DEFAULT_INDEX_URL,把它改为:

DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'

现在你就可以重新输入rosdep update了,然后就成功了!

猜你喜欢

转载自blog.csdn.net/m0_74923682/article/details/129405081
今日推荐