camelot 安装和使用踩坑

2022-12-26  本文已影响0人  JeremyL

#报错1 AttributeError: module 'camelot' has no attribute 'read_pdf'

pip uninstall camelot
pip install "camelot-py[base]"

#报错2 Getting PyPDF2 error while using the camelot library

pip uninstall PyPDF2
pip uninstall PyPDF2===1.26.0

# ghostscript安装

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
brew install ghostscript

# 使用camelot

import camelot.io as camelot
import glob
PDFFile = glob.glob(r'./PDF/*.pdf')
tables = camelot.read_pdf(PDFFile[1], pages='all')   
print(tables[0].df) 
tables[0].to_csv("test.csv ")

# 参考

Camelot: PDF Table Extraction for Humans
Install ghostscript on Mac OSX
AttributeError: module 'camelot' has no attribute 'read_pdf'

上一篇下一篇

猜你喜欢

热点阅读