Python 2.7:导入slate时出错
我在使用slate for Python时遇到问题。当我尝试导入slate库时,收到以下错误:Python 2.7:导入slate时出错,python,python-2.7,Python,Python 2.7,我在使用slate for Python时遇到问题。当我尝试导入slate库时,收到以下错误: Ì导入错误:无法导入名称PDFDocument 我使用pip(Ubuntu 17终端)安装了slate,我使用的确切命令是: pip安装slate 以下是我试图解决这个问题的一些事情: 已安装的PDFMiner,slate依赖于它 在尝试导入slate之前已导入所有pdfminer 我在终端中尝试了以下命令: pip安装--升级-- ignoreinstalled slate==0.3 pdfmine
Ì导入错误:无法导入名称PDFDocument
我使用pip(Ubuntu 17终端)安装了slate,我使用的确切命令是:
pip安装slate
以下是我试图解决这个问题的一些事情:
pip安装--升级--
ignoreinstalled slate==0.3 pdfminer==20110515
但收到一个错误,表示slate的0.3版本无效import slate
pdf = 'test.pdf'
with open(pdf) as f:
doc = slate.PDF(f)
for page in doc[:2]:
print page
所以,这有点尴尬(回答我自己的问题),但我找到了一个解决方案,以防其他人遇到同样的问题 步骤1:卸载pdfminer
pip卸载pdfminer
步骤2:安装特定版本的pdfminer:20110515(这似乎是使用slate的最后一个版本)
pip install pdfminer==20110515
因此,这有点尴尬(回答我自己的问题),但我找到了一个解决方案,以防其他人遇到同样的问题
步骤1:卸载pdfminer
pip卸载pdfminer
步骤2:安装特定版本的pdfminer:20110515(这似乎是使用slate的最后一个版本)
pip安装pdfminer==20110515