geopy.exc.GeocoderServiceError: [SSL: CERTIFICATE_VERIFY_FAILED]

问题描述

我最近在使用 geopy,当我尝试使用它的地理编码器部分时,它给了我错误

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py",line 1346,in do_open
    h.request(req.get_method(),req.selector,req.data,headers,File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py",line 1253,in request
    self._send_request(method,url,body,encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py",line 1299,in _send_request
    self.endheaders(body,encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py",line 1248,in endheaders
    self._send_output(message_body,line 1008,in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py",line 948,in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py",line 1422,in connect
    self.sock = self._context.wrap_socket(self.sock,File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py",line 500,in wrap_socket
    return self.sslsocket_class._create(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py",line 1040,in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py",line 1309,in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_Failed] certificate verify Failed: unable to get local issuer certificate (_ssl.c:1129)

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/adapters.py",line 251,in get_text
    page = self.urlopen(req,timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py",line 517,in open
    response = self._open(req,data)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py",line 534,in _open
    result = self._call_chain(self.handle_open,protocol,protocol +
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py",line 494,in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py",line 1389,in https_open
    return self.do_open(http.client.HTTPSConnection,req,File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py",line 1349,in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_Failed] certificate verify Failed: unable to get local issuer certificate (_ssl.c:1129)>

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
  File "/Users/syedrishad/Downloads/Code/python_basics/basics.py",line 8,in <module>
    n= nom.geocode("3995 23rd St,San Francisco,CA 94114")
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/geocoders/arcgis.py",line 173,in geocode
    return self._authenticated_call_geocoder(url,callback,timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/geocoders/arcgis.py",line 260,in _authenticated_call_geocoder
    return self._call_geocoder(url,parse_callback,timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/geocoders/base.py",line 360,in _call_geocoder
    result = self.adapter.get_json(url,timeout=timeout,headers=req_headers)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/adapters.py",line 240,in get_json
    text = self.get_text(url,headers=headers)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/adapters.py",line 268,in get_text
    raise GeocoderServiceError(message)
geopy.exc.GeocoderServiceError: [SSL: CERTIFICATE_VERIFY_Failed] certificate verify Failed: unable to get local issuer certificate (_ssl.c:1129)

搜索了这个错误,显然,我所要做的就是转到我的 python 文件夹并双击“安装 Certificates.command”文件。除了一件事。我在 Mac 上,这意味着我必须使用 brew install python3 命令下载 Python。我在任何地方都找不到 Python 文件夹,这意味着我无法双击“Install Certificates.command”文件。有没有人对我能做什么有任何建议。感谢任何和所有帮助

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)