简体   繁体   中英

Cannot import 'PyPDF2' in Python 3.7

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 (ie 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

您可以执行以下操作:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM