证书验证失败:无法获取本地发行者证书 [英] certificate verify failed: unable to get local issuer certificate

查看:813
本文介绍了证书验证失败:无法获取本地发行者证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用python从网络获取数据.我为此导入了urllib.request包,但是在执行时却出现错误:

I am trying to get data from the web using python. I imported urllib.request package for it but while executing, I get error:

certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)

  • 我正在Mac OS High Sierra上使用Python 3.7.
  • 我正试图从以下位置获取CSV文件: https://s3.amazonaws.com/assets .datacamp.com/production/course_1606/datasets/winequality-red.csv
    • I am using Python 3.7 on Mac OS High Sierra.
    • I am trying to get CSV file from: https://s3.amazonaws.com/assets.datacamp.com/production/course_1606/datasets/winequality-red.csv
    • 当我将URL更改为"http"时-我能够获取数据.但是,我相信这可以避免检查SSL证书.

      When I changed the URL to 'http' - I am able to get data. But, I believe, this avoids checking SSL certificate.

      因此,我在互联网上查看了一个解决方案: 运行/Applications/Python\ 3.7/Install\ Certificates.command

      So I checked on the internet and found one solution: Run /Applications/Python\ 3.7/Install\ Certificates.command

      这解决了我的问题.但是我对SSL之类的东西一无所知.您能否帮助我了解它实际上解决了我的问题.

      This solved my problem. But I have no knowledge on SSL and the likes. Can you help me understand what it actually did to solve my issue.

      如果可能,请向我推荐任何有用的资源,以了解有关安全性和证书的信息.我是新来的.

      If possible, please recommend me any good resource to learn about the security and certificates. I am new to this.

      谢谢!

      注意:我确实通过链接- openssl,python请求错误: 证书验证失败"

      Note: I did go through the link - openssl, python requests error: "certificate verify failed"

      我的问题不同于链接中的问题,因为我想知道在安装certifi软件包或运行Install\ Certificates.command来修复错误时实际发生的情况.我对证券知之甚少.

      My question differs from the one in link because, I want to know what actually happens when I install certifi package or run Install\ Certificates.command to fix the error. I have a poor understanding of securities.

      推荐答案

      对于仍然想知道如何解决此问题的任何人,我都可以通过安装"Install Certificates.command"

      For anyone who still wonders on how to fix this, i got mine by installing the "Install Certificates.command"

      这是我的做法,

      只需双击该文件等待其安装,就我而言,您就可以开始使用

      Just double click on that file wait for it to install and in my case, you will be ready to go

      这篇关于证书验证失败:无法获取本地发行者证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆