#报错1 AttributeError: module 'camelot' has no attribute 'read_pdf'
- 卸载camelot,重新安装
pip uninstall camelot
pip install "camelot-py[base]"
#报错2 Getting PyPDF2 error while using the camelot library
- camelot requirements.txt 中显示PyPDF2>=1.26.0
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'