解决rosdep init 和 rosdep update出错

在安装ros时,执行rosdep命令时会出现超时或者连接被拒绝的错误。

例如下面的连接超时,就是因为国内网络的原因,

ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:
	 (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)

解决rosdep init 和 rosdep update出错_第1张图片

还有一种错误会提示,Connection refused,这一般是由于代理没设置正确造成的

reading in sources list data from /etc/ros/rosdep/sources.list.d
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:
     (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)

  1. 要解决这个问题,首先系统必须得有代理,例如
socks5 127.0.0.1 1080
  1. 接下来,是设置shell,即终端的代理,让终端的网络走系统的代理

下载proxychains-ng代码,

https://github.com/rofl0r/proxychains-ng

编译,可以不用安装,

./configure --prefix=/usr --sysconfdir=/etc
 make

修改src\proxychains.conf配置文件,在最后按照说明加上你系统的代理,

解决rosdep init 和 rosdep update出错_第2张图片

在源代码下执行,

./proxychains4 -f src/proxychains.conf rosdep update

从上面的命令可以看出来,proxychains4的作用就是在你需要执行的Linux 命令前加上proxychains4 -f src/proxychains.conf,执行的效果如下图所示。

解决rosdep init 和 rosdep update出错_第3张图片


以上解决办法,可以解决任何在shell终端中某些命令因为网络原因无法正常执行的相关问题。


在使用git时,也会出现类似上面的情况,不过git有自己的代理配置工具,可以是直接使用命令进行设置,也可以编辑~/.gitconfig文件

  1. 使用命令

http代理:

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080

socks5代理:

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
  1. 编辑文件~/.gitconfig

在文件添加:

[http]
proxy = socks5://127.0.0.1:1080
[https]
proxy = socks5://127.0.0.1:1080

然后就可以直接使用git命令重新下载了。

  1. 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy

你可能感兴趣的:(ros)