I pip installed pdfminer: https://pypi.python.org/pypi/pdfminer/20140328 on ubuntu 13.10 and that successfully installed into /usr/local/lib/python2.7/dist-packages/pdfminer
when I try to run the example code:
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.pdfdevice import PDFDevice
if __name__=='__main__':
# Open a PDF file.
fp = open('MyPDF.pdf', 'rb')
I keep getting
ImportError: No module named pdfparser
I have verified that pdfparser exists and there is a __init__.py
file in the pdfminer folder. I have tried recreating the __init__.py
file. I have also tried runing chmod -R 777 pdfminer
but that doesn't fix it either.
I have run env
but there is no PYTHONPATH
there is that a problem? I have also tried installing PDFMiner into a virtualenv but that doesn't work either. I noticed that PDFMiner requires root permissions to install is that the problem?
what am I doing wrong?
Have you tried
from pdfminer import pdfparser
or
import pdfminer.pdfparser
?
Are you running the code from a file called pdfminer.py?
This was causing the error in my case. Python was trying to import the module from the file of the same name.
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.