python2.7:[SSL:UNKNOWN_PROTOCOL]未知协议

时间:2018-03-01 13:30:59

标签: python python-2.7 ssl proxy urllib

我试图从源代码安装ROS。

当我执行安装命令时,出现了这样的错误:

Traceback (most recent call last):
  File "/home/zyh/ros_catkin_ws/install_isolated/share/ros/core/rosbuild/bin/download_checkmd5.py", line 126, in <module>
    sys.exit(main())
  File "/home/zyh/ros_catkin_ws/install_isolated/share/ros/core/rosbuild/bin/download_checkmd5.py", line 73, in main
    urllib.urlretrieve('https://github.com/assimp/assimp/archive/v3.1.1.zip', dest)
  File "/usr/lib/python2.7/urllib.py", line 98, in urlretrieve
    return opener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python2.7/urllib.py", line 245, in retrieve
    fp = self.open(url, data)
  File "/usr/lib/python2.7/urllib.py", line 213, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.7/urllib.py", line 443, in open_https
    h.endheaders(data)
  File "/usr/lib/python2.7/httplib.py", line 1038, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 882, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 844, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1263, in connect
    server_hostname=server_hostname)
  File "/usr/lib/python2.7/ssl.py", line 363, in wrap_socket
    _context=self)
  File "/usr/lib/python2.7/ssl.py", line 611, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 840, in do_handshake
    self._sslobj.do_handshake()
IOError: [Errno socket error] [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:661)
/home/zyh/ros_catkin_ws/install_isolated/share/mk/download_unpack_build.mk:37: recipe for target 'build/assimp-3.1.1/unpacked' failed
make[3]: *** [build/assimp-3.1.1/unpacked] Error 1

我不知道如何解决这个问题。也许是因为我在代理背后工作?如果是这样,如何让urllib.urlretrieve在代理服务器后工作?

1 个答案:

答案 0 :(得分:0)

将代理设置添加到您的全局环境,以查看它是否解决了问题。

sudo gedit /etc/environment

然后添加这两行

http_proxy=http://your_proxy.com:443
https_proxy=https://your_proxy.com:443