1.問題
在安裝ros的時候需要使用sudo rosdep init
和rosdep update
初始化rosdep,但是此時會出現如下錯誤:
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.
2.原因
網上各種說法,我幾乎試了都不行,有的甚至說要更換網絡,使用手機熱點,根本沒有那麼麻煩,這裏的主要原因就是:
github的某些域名的dns解析被污染了!!
github的某些域名的dns解析被污染了!!
github的某些域名的dns解析被污染了!!(重要的事情說三遍)。
3.解決辦法
修改方法十分簡單,更換對應ip進行訪問就行。如果是linux系統,使用如下命令打開文件:
sudo gedit /etc/hosts
然後將下面這一行內容,複製到hosts
文檔的最後面,然後保存關閉,問題解決。
151.101.84.133 raw.githubusercontent.com
如果是windows或者mac系統,找到hosts
文件對應的位置,按照上述方法增加一行,也能解決問題。
注意:修改之後運行rosdep update
提示說:下面這個文件已經存在,需要你刪掉,那麼你把它刪掉。
ERROR: default sources list file already exists:
/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize
4.選擇更快的ip
在解決辦法中提供了一個ip,如果速度不夠快,或者ip不能用了,你可以自己按照上面的方法更換ip,ip查詢地址爲https://site.ip138.com/raw.githubusercontent.com/
進入網站輸入:raw.githubusercontent.com
自己ping一下找到最快的ip,然後保存到hosts
文件中。
如果你的github網頁打開比較慢,那麼你也可以使用上面的網站查詢github.com
哪個ip最快,然後在host
中修改。