Github cv-parser项目中pdfminer导入PDFParser报错求助
I've run into this exact issue before when working with older resume parser projects. Let's break down the two main problems causing this error and fix them step by step:
1. You're using an obsolete/unmaintained pdfminer package
The original pdfminer package is no longer updated, and modern Python projects rely on pdfminer.six—a Python 3-compatible fork that's actively maintained. Let's clean up and install the correct package:
- Uninstall the old
pdfminer(if it's already installed):pip uninstall pdfminer -y - Install the supported, compatible version:
pip install pdfminer.six
2. The import path in your code is incorrect
Looking at your error trace, you're trying to import PDFParser from pdfminer.pdfdocument—but PDFParser actually belongs to the pdfminer.pdfparser module! Open parsecv.py and fix line 14 to:
from pdfminer.pdfparser import PDFParser from pdfminer.pdfdocument import PDFDocument
(You can combine these into a single line if you prefer, but splitting them makes it clearer which class comes from which module.)
After making these two changes, run your script again—the import error should be resolved.
内容的提问来源于stack exchange,提问作者HADDAD Ahmed

