pdfminer - import error

2019-05-24 08:20发布

问题:

I’m new to Python and programming in general.

I am trying to install pdfMiner. I have Windows 7 with Python 2.7 installed. I followed the instructions when installing (downloaded the PDFMiner source, unpacked it, and ran setup.py to install and it was installed in C:\pdfminer) – no errors.

It created: build, build\lib,build\lib\pdfminer, then copied files to build\lib\pdfminer. It created build\scripts-2.7 and copied tools\pdf2txt.py, dymppdf.py to scripts, then wrote install-egg-info and had no errors with install.

When I try running the test document from the command line:

C:\pdfminer\pdfminer-20140328> pdf2txt.py samples/simple1.pdf

I get:

File “C:\Python27\Scripts\pdf2txt.py”, line3, in <module> from pdfminer.pdfdocument import PDFDocument
ImportError:  No module named pdfminer.pdfdocument

I saw this post:

pdfminer - ImportError: No module named pdfminer.pdfdocument

and tried following it (#1..put sys.path.append… into pdf2txt.py) and get the same error.

The system variables do include the path (pdfminer\pdfminer-20140328).

I’ve looked for other solutions but haven’t had much luck – the file is there but I can’t seem to get the program to look in the right area for it…I think.

Do I have the wrong path or is it installed in the wrong directory?