当我尝试导入 pdfplumber 时,它给了我这个错误:
Python 3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pdfplumber
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-b3d6737fd8e1> in <module>()
----> 1 import pdfplumber
/anaconda3/lib/python3.6/site-packages/pdfplumber/__init__.py in <module>()
---->
1 from pdfplumber.pdf import PDF
2 import pdfplumber.utils
3 import pdfminer
4 import pdfminer.pdftypes
5 from ._version import __version__
/anaconda3/lib/python3.6/site-packages/pdfplumber/pdf.py in <module>()
4
5 from pdfminer.pdfparser import PDFParser
----> 6 from pdfminer.pdfdocument import PDFDocument
7 from pdfminer.pdfpage import PDFPage
8 from pdfminer.pdfinterp import PDFResourceManager,
PDFPageInterpreter
/anaconda3/lib/python3.6/site-packages/pdfminer/pdfdocument.py in <module>()
24 from .pdftypes import PDFTypeError
25 from .pdftypes import PDFStream
---> 26 from .pdftypes import PDFObjectNotFound
27 from .pdftypes import decipher_all
28 from .pdftypes import int_value
ImportError: cannot import name 'PDFObjectNotFound'
有什么解决办法吗?
请检查您的
pip list
。
如果您已安装
pdfminer3k
(不是 pdfminer
),请尝试先卸载 pdfminer3k
,然后重新安装 pdfplumber
。
我遇到了同样的问题,我就是这样解决的。
您应该按照此处的指导安装
imagemagick
安装后重启,然后再次导入
pdfplumber