rosdep update遇到The read operation timed out問題


1、問題背景

Ubuntu18.04 安裝ROS Melodic。

在安裝過程中執行命令:

rosdep update

報錯如下:

ERROR: error loading sources list: The read operation timed out

主要原因是國外的服務器訪問受限的問題。


2、解決方法

此方法中心思想為更改下載資源,應用ghproxy代理服務,接下來一步一步操作就可以了。

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

在311行左右,添加這樣的代碼:

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

修改結果如下:

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

在69行左右,講DEFAULT_INDEX_URL的網址進行修改:

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

修改結果如下:

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

在36行左右,在網址前添加:

https://ghproxy.com/

修改結果如下:

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

在72行左右,在網址前添加:

https://ghproxy.com/

修改結果如下:

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

在39行左右,在網址前添加:

https://ghproxy.com/

修改結果如下:

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

分別在68行和119行左右,在兩個網址前添加:

https://ghproxy.com/

修改結果如下:

以及
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py

在204行左右,添加如下代碼:

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

修改結果如下:

運行如下命令:

sudo apt-get update
rosdep update

如果幸運的話,就可以成功update了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM