It appears I was able to import PyPDF2 using non-admin mode. However, I got this error when the code is run. How can I fix it?
Solved! Go to Solution.
I'm not much of a Python person - but two quick things - one can you check if all of your dependencies are included (ie openpyxl - that seems to be an issue sometimes - see here: https://stackoverflow.com/questions/74475530/importerror-cannot-import-name-pdfreader-from-pypdf2)
two - if you are importing a specific method (ie "
from PyPDF2 import PdfReader
Wouldn't you refer to it just as PdfReader when using later in the code (not PyPDF2.PdfReader - since you've overtly declared your intent to use it)
from PyPDF2 import PdfReader reader = PdfReader("example.pdf") number_of_pages = len(reader.pages) page = reader.pages[0] text = page.extract_text()
Yes you’re right. I removed PyPDF2 in the later lines and the error was gone. Thank you!