用python pptx打开演示文稿

时间:2015-07-02 02:33:36

标签: python powerpoint

我在python中有一些代码用于打开.pptx - 使用LibreOffice的文件:

from pptx import Presentation

prs = Presentation('tes.pptx')

如果我在Raspbian上运行此代码,我收到此错误消息:

File "bukappt.pt", line 1, in <module>
 from pptx import Presentation
File "/usr/local/lib/python2.7/dist-packages/pptx/_init_.py", line 15, in <module>
 from pptx.api import Presentation # noqa
File "/user/local/lib/python2.7/dist-packages/pptx/api.py", line 14, in <module>
 from ppx.package import Package
File "/usr/local/lib/python2.7/dist-packages/pptx/parts/image.py", line 13, in <module>
  import Image as PIL_Image
ImportError: No modulenamed Image

如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

这是因为没有安装Pillow成像库。要使其工作,您需要安装枕头。 https://pypi.python.org/pypi/Pillow/2.9.0