简体   繁体   English

Windows:ImportError:没有名为Image的模块

[英]Windows: ImportError: No module named Image

I'm trying to create a function which reads pptx files. 我正在尝试创建一个读取pptx文件的函数。 The only module I found is python-pptx . 我发现的唯一模块是python-pptx But unfortunately, it raises errors. 但不幸的是,它会引发错误。

There were some problems with installing Pillow when I did: pip install python-pptx so I installed it easy_install Pillow which seems to be working. 我安装Pillow时遇到一些问题: pip install python-pptx所以我安装了easy_install Pillow ,它似乎可以正常工作。 Then I installed python-pptx . 然后我安装了python-pptx The problem is that when I execute the function it still raises error: 问题是,当我执行该函数时,它仍然会引发错误:

Traceback (most recent call last):
  File "C:/Users/Milano/Desktop/Projekty/FS Dropbox/Dropbox/word_counter.py", line 38, in <module>
    print get_pptx_word_count('pptx.pptx')
  File "C:/Users/Milano/Desktop/Projekty/FS Dropbox/Dropbox/word_counter.py", line 15, in get_pptx_word_count
    from pptx import Presentation
  File "C:\Users\Milano\Desktop\Projekty\venvs\sfl_venv\lib\site-packages\pptx\__init__.py", line 15, in <module>
    from pptx.api import Presentation  # noqa
  File "C:\Users\Milano\Desktop\Projekty\venvs\sfl_venv\lib\site-packages\pptx\api.py", line 17, in <module>
    from .package import Package
  File "C:\Users\Milano\Desktop\Projekty\venvs\sfl_venv\lib\site-packages\pptx\package.py", line 16, in <module>
    from .parts.image import Image, ImagePart
  File "C:\Users\Milano\Desktop\Projekty\venvs\sfl_venv\lib\site-packages\pptx\parts\image.py", line 13, in <module>
    import Image as PIL_Image
ImportError: No module named Image

What should I do? 我该怎么办? I'm on virtualenv . 我在virtualenv Tried to uninstall Pillow and install PIL but it didn't find anything. 尝试卸载Pillow并安装PIL,但没有找到任何东西。

pillow moves all the PIL modules to the PIL package. 枕头将所有PIL模块移到PIL包中。 You will need to modify the import to PIL.Image . 您将需要将导入修改为PIL.Image

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM