본문 바로가기
Programming/python

python SSLerror

by 단창 2023. 10. 27.

"certificate verify failed: unable to get local issuer certificate"
"ConnectionError: Couldn't reach '~~~~~' on the Hub (SSLError)"

huggingface 쓰면서 조우한 error인데 huggingface에만 국한된건 아니고
urllib 나 requests 등 https 통신 할때 발생하는 SSLerror 이다. 

내 환경은 우분투 였고 https://stackoverflow.com/questions/10667960/python-requests-throwing-sslerror 이곳 통해 해결 

# debian
os.environ['REQUESTS_CA_BUNDLE'] = os.path.join(
    '/etc/ssl/certs/',
    'ca-certificates.crt')

SSL인증 파일 (/etc/ssl/certs/ca-certificates.crt) 위치를 넣어준 것. 윈도우도 비슷하게 해결될것 같다. 

반응형