Tabula-py - ImportError: No module named tabula

一个人想着一个人 提交于 2019-12-24 10:58:25

问题


I am trying to use Tabula-py to read a pdf. I installed tabula-py through pip install tabula-py

I have also installed the required dependencies

requests
pandas
pytest
flake8

My code is currently as follows:

import tabula
import pandas as pd

df = tabula.read_pdf("report.pdf", pages=2)
print(df)

I am getting the following error:

Traceback (most recent call last):
File "tabula_pdf_reader.py", line 1, in <module>
  import tabula
ImportError: No module named tabula

Any inputs to what I am missing here?


回答1:


I faced this same issue in Ubuntu.

First, check the version of the JDK and JRE that are installed on your machine by running java --version and javac --version. Each should have a version greater than 7.

Then use pip3 to install tabula.




回答2:


I got the same issue here when executing on Terminal. However, after I ran by starting with 'ipython3' instead of 'ipython', it worked perfectly. You have to make sure that tabula-py module is installed in python3 directory, not python2




回答3:


use this

 import camelot
 tables = camelot.read_pdf('foo.pdf')
 tables.export('foo.csv', f='csv', compress=True)


来源:https://stackoverflow.com/questions/45596477/tabula-py-importerror-no-module-named-tabula

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!