尝试在 Jupiter Notebook 中导入 osmnx 数据时超出 SSL 错误(端口 = 443)最大重试次数
当尝试运行这条线时 G = ox.graph_from_place('美国加利福尼亚州皮埃蒙特', network_type='drive') 我收到此错误:
SSLError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?format=json&polygon_geojson=1&dedupe=0&limit=50&q=Piedmont%2C+CA%2C+USA (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
我用谷歌搜索并发现这可能是一个解决方案,但我收到了相同的错误消息:
from geopy.geocoders import Nominatim
geopy.geocoders.options.default_user_agent = 'my_app/1'
geopy.geocoders.options.default_timeout = 7
geolocator = Nominatim()
print(geolocator.headers)
{'User-Agent': 'my_app/1'}
print(geolocator.timeout)
(我在上面的代码中将 my/app_1 更改为“ABC”)
我也尝试过 - 从那时起在 stackoverflow 上的另一个解决方案中,这个:
pip install certifi
但是出现了相同的 SSL 错误。
我在 Mac(OS Big Sur)和 Jupiter Notebook 6.3.0 上使用 Anaconda Navigator 2.1.1
有人能告诉我我做错了什么吗?我是公司代理的幕后黑手,我认为这就是问题所在。
When trying to run this line
G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')
I get this error:
SSLError: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /search?format=json&polygon_geojson=1&dedupe=0&limit=50&q=Piedmont%2C+CA%2C+USA (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
I googled and found this could be a solution but I got the same error message:
from geopy.geocoders import Nominatim
geopy.geocoders.options.default_user_agent = 'my_app/1'
geopy.geocoders.options.default_timeout = 7
geolocator = Nominatim()
print(geolocator.headers)
{'User-Agent': 'my_app/1'}
print(geolocator.timeout)
(I changed my/app_1 to "ABC" in the code above)
I also tried - since that was in another solution on stackoverflow, this:
pip install certifi
but the same SSL-error appeared.
I'm using Anaconda Navigator 2.1.1 on Mac (OS Big Sur) and Jupiter Notebook 6.3.0
Can someone tell me what I'm doing wrong please? I'm behind a company proxy and assume that's the issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此 URL 在您的浏览器中是否有效:
https://nominatim.openstreetmap.org//search?format=json&polygon_geojson=1&dedupe=0&limit=50&q=Piedmont%2C+CA%2C+USA
您也可以设置请求参数:
ox.config(request_kwargs={})
Does this URL work in your browser:
https://nominatim.openstreetmap.org//search?format=json&polygon_geojson=1&dedupe=0&limit=50&q=Piedmont%2C+CA%2C+USA
you can also set request params:
ox.config(request_kwargs={})