SSL: CERTIFICATE_VERIFY_FAILED with urllib

前端 未结 4 565
南旧
南旧 2020-12-28 20:19

I\'m running into trouble with the module urllib (Python 3.6). Every time I use the module, I get a page\'s worth of errors.

what\'s wrong with urllib and how to fi

相关标签:
4条回答
  • 2020-12-28 20:46

    a dirty but fast hack like this do the job for me:

    import ssl
    
    ssl._create_default_https_context = ssl._create_unverified_context
    
    0 讨论(0)
  • 2020-12-28 21:01

    I had the same issue. My python version is 3.6.5 and I'm on Mac OSX. When I tried to connect to the HTTPS sites I started getting the

    <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)>

    exception. So, it was so obvious to me that the python on my machine has no certificates. I just ran the file from the path /Applications/Python 3.6 with a file name Install Certificates.command. This solved my issue. I reffered to this post.

    0 讨论(0)
  • 2020-12-28 21:01

    To fix the problem, open your bash and write:

    cd /Applications/Python 3.6
    

    then:

    sudo Certificates.command
    
    0 讨论(0)
  • 2020-12-28 21:05

    There is command line program that you can run on MacOsX that will install the certificates:

    sudo /Applications/Python\ 3.6/Install\ Certificates.command
    

    The sudo command will prompt for you password to elevate your privileges.

    0 讨论(0)
提交回复
热议问题