Python3 解决pip报ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)

Exception:
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 493, in urlopen
    body=body, headers=headers)
  File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 291, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Python34\lib\http\client.py", line 1090, in request
    self._send_request(method, url, body, headers)
  File "C:\Python34\lib\http\client.py", line 1128, in _send_request
    self.endheaders(body)
  File "C:\Python34\lib\http\client.py", line 1086, in endheaders
    self._send_output(message_body)
  File "C:\Python34\lib\http\client.py", line 924, in _send_output
    self.send(msg)
  File "C:\Python34\lib\http\client.py", line 859, in send
    self.connect()
  File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 190, in connect
    ssl_version=resolved_ssl_version)
  File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py", line 124, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Python34\lib\ssl.py", line 364, in wrap_socket
    _context=self)
  File "C:\Python34\lib\ssl.py", line 578, in __init__
    self.do_handshake()
  File "C:\Python34\lib\ssl.py", line 805, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)

 

本来打算用Python 加载openpyxl 模块来处理excel文件~但是总是报SSL错误~
网友分析是没办法通过证书验证,需要关闭证书验证功能~~

先记录Python3.4 自己实践出来的修改方法:C:\Python34\Lib\site-packages\pip\_vendor\requests\adapters.py

Python3 解决pip报ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)_第1张图片

304 行为我自己增加的设置

如日志显示,successfully installed openpyxl jdcal et-xmlfile

打开Python  shell,测试import openpyxl,没有报找不到模块如下为临时读取的Excel 中的数据,模块的函数都生效了

Python3 解决pip报ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)_第2张图片

感谢一下两位网友的分享~使得pip可以正常使用

https://blog.csdn.net/xfyangle/article/details/62052945

https://stackoverflow.com/questions/27499456/requests-s-geturl-verify-false-error-python

最后,该方法应该使用与Python3的所有版本,请热心网友分享下结果,让初学者更方便搞定环境,增加学习信心~~~

谢谢!

你可能感兴趣的:(Python安装)