问题描述
面临以下问题:有人可以帮忙吗?请..
import camelot
# PDF file to extract tables from
file = input_folder+file_name
tables = camelot.read_pdf(file)
# number of tables extracted
print("Total tables extracted:",tables.n)
# print the first table as Pandas DataFrame
print(tables[0].df)
Error: AttributeError: module 'camelot' has no attribute 'read_pdf'
解决方法
这个错误很可能是因为你安装了错误的包。
当你安装了camelot模块时,你应该使用过这个:
pip install camelot-py[cv]
如果没有,请卸载您安装的软件包并使用上述命令。
,我遇到了同样的问题并尝试了很多东西,包括安装/卸载各种camelot包、克隆git等。它对我不起作用。我发现这个问题与 CV2 有关。服务器(无头)环境没有安装 GUI 包,所以如果你在没有 GUI 的服务器上使用 Camelot,你应该先安装 opencv-python-headless:
pip install opencv-python-headless
然后与camelot.io一起导入,而不是camelot:
import camelot.io as camelot
import cv2