Dan*_*lHe 4 python pdf excel pandas tabula
我试图使用tabula-py将表格从pdf转移到excel.
当我试图
from tabula import read_pdf
Run Code Online (Sandbox Code Playgroud)
它说
ImportError:无法导入名称'read_pdf'
我发现的所有解决方案都说我必须这样做
pip uninstall tabula
pip3 install tabula-py
Run Code Online (Sandbox Code Playgroud)
https://github.com/chezou/tabula-py/issues/47
Tabula-py - ImportError:没有名为tabula的模块
但它仍然不适合我.
有任何想法吗?
from tabula import wrapper
df = wrapper.read_pdf('my_pdf')
Run Code Online (Sandbox Code Playgroud)
read_pdf包含在'wrapper'中.因此,您导入包装器并从包装器调用read_pdf.
也许这是因为您安装的 tabula 版本。
如果您通过运行安装了 tabula:
pip install tabula
Run Code Online (Sandbox Code Playgroud)
你得到一个旧版本的 tabula (1.0.5),它有模块 .read_pdf() 的问题。要解决该问题并获得更新版本的 tabula,请首先:
使用以下命令卸载 tabula:
pip uninstall tabula
Run Code Online (Sandbox Code Playgroud)
并使用以下命令安装较新版本的 tabula:
pip install tabula-py
Run Code Online (Sandbox Code Playgroud)
我认为这将解决您的问题。