错误【ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed...】

Downloading: "https://download.pytorch.org/models/resnet50-19c8e357.pth" to /home/luanhaijing/.cache/torch/hub/checkpoints/resnet50-19c8e357.pth
Traceback (most recent call last):
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/urllib/request.py", line 1319, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/http/client.py", line 1422, in connect
    server_hostname=server_hostname)
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/data/luanhaijing/project/Ltoad_env/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)

解决办法:只需要将其中的https换成http即可成功解决


版权声明:本文为qq_36717487原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。