AttributeError: 模块'tabula'没有属性'read_pdf

1 投票
1 回答
111 浏览
提问于 2025-04-14 18:06
import tabula 

from tabula.io import read_pdf

tables =tabula.read_pdf (' C:/Users/mothe/OneDrive/Desktop/Sample.pdf ')


print (tables)

我在使用Visual Studio Code运行下面的代码时,总是遇到这个错误:

AttributeError: module 'tabula' has no attribute 'read_pdf'

我之前安装了tabula,然后又安装了tabula-py,现在我通过 using pip uninstall tabula 卸载了tabula,但问题还是没有解决。我该怎么处理这个问题呢?

我原本希望不会出现这个属性错误,并且能够打印出表格。

1 个回答

0

好的,稍微更新一下,我之前在我的Windows终端、Spyder、Visual Studio 2019和VS Code上尝试这些都没成功,最近我在PyCharm上运行了一下,结果成功了!我现在可以用Tabula生成表格了!

这里输入图片描述

现在我唯一遇到的问题是缺少一些列,不过我相信这应该不难解决。

撰写回答