为python运行lambda函数时出现错误

问题描述 投票:0回答:1

错误信息:Please make sure that Ghostscript is installed", "errorType": "RuntimeError"

import camelot

   def pdfToJson(event=None,context=None): 
       tables = camelot.read_pdf("./week-1-2019-20.pdf")  
       tables[0].df.to_json("./sample.json")
  1. 使用pip install -t安装了依赖项。
  2. 但仍然出现错误。

所以如何在我的python代码中安装“ ghostscript”依赖项。

ghostscript python-camelot
1个回答
0
投票

camelot库中,与Ghostscript的通信是通过使用ctypes的低级C-API接口完成的。 Ghostscript用于从库处理的pdf生成图像。

您不需要自己安装任何python绑定,唯一的要求就是Ghostscript本身。最简单的安装方法是在Ubuntu上使用repositories/CD,就像这样:

sudo apt-get install -y ghostscript
gs --version
© www.soinside.com 2019 - 2024. All rights reserved.