AttributeError:模块“camelot”没有属性“read_pdf”

新手上路,请多包涵

我正在尝试使用 camelot 从 pdf 中提取表格,但出现此属性错误。能否请你帮忙?

 import camelot
import pandas as pd
pdf = camelot.read_pdf("Gordian.pdf")

AttributeError Traceback(最近调用最后)在 —-> 1 pdf = camelot.read_pdf(“Gordian.pdf”)

AttributeError:模块“camelot”没有属性“read_pdf”

原文由 Yousra 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.1k
1 个回答

注意如果您使用的是虚拟环境,请在执行此操作之前激活环境。

我已经遇到过这个错误。您的代码中没有错误。问题出在 camelot 安装上。

1 删除已安装的 camelot 版本

2 使用此命令再次安装。有多种安装 camelot 的方法。请一一尝试

  • pip install camelot-py
  • pip install camelot-py[cv]
  • pip install camelot-py[all]

3 运行你的代码 >> 我在这里附上了示例代码

import camelot

data = camelot.read_pdf("test_file.pdf", pages='all')
print(data)

原文由 waruna k 发布,翻译遵循 CC BY-SA 4.0 许可协议

推荐问题