python 中requests 模块用py2exe生成exe后SSL certificate exception的问题

[('system library', 'fopen', 'No such process'), ('BIO routines', 'BIO_new_file', 'no such file'), ('x509 certificate routines', 'X509_load_cert_crl_file', 'system lib')]

解决:
1) Place the below code in your main python file where “requests” module is used

os.environ['REQUESTS_CA_BUNDLE'] = "certifi/cacert.pem"

2) Within your distributable folder where exe is present, create a folder called “certifi” and place the “cacert.pem” file within it.

3) You can find the “cacert.pem” file by

pip install certifi

import certifi
certifi.where()

or you can copy it from python installation path, e.g. C:\Python27\Lib\site-packages\pip\_vendor\certifi

posted @ 2018-08-24 16:54  feiwatson  阅读(268)  评论(0编辑  收藏  举报