Cannot import 'PyPDF2' in Python 3.7

萝らか妹 提交于 2019-12-11 14:36:54

问题


I am wondering, why, for the life of me I cannot import and use PyPDF2 (PDF library) in Python 3.7.

Firstly, my import fails at top of main.py (i.e. below)

from PyPDF2 import PdfFileReader

Then I have tried pip install PyPDF2 and variants pip2 install PyPDF3 etc etc.

All lead to the below output:

  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pypdf2/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pypdf2/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pypdf2/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pypdf2/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1051)'))': /simple/pypdf2/

  Could not find a version that satisfies the requirement PyPDF2 (from versions: )
No matching distribution found for PyPDF2

回答1:


You can do something like this:

pip install https://pypi.org/project/PyPDF2/1.23/


来源:https://stackoverflow.com/questions/57100089/cannot-import-pypdf2-in-python-3-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!