问题
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