我想导入 pptx,但我正在使用这个
import sys
sys.path.insert(0,'D:/apera/python27/python-pptx-0.5.6')
import pptx
但不知何故它显示这样的错误
Traceback (most recent call last):
File "D:/apera/Workspace/Python scripting test 6/ppt.py", line 5, in <module>
import pptx
File "D:/apera/python27/python-pptx-0.5.6\pptx\__init__.py", line 15, in <module>
from pptx.api import Presentation # noqa
File "D:/apera/python27/python-pptx-0.5.6\pptx\api.py", line 14, in <module>
from pptx.package import Package
File "D:/apera/python27/python-pptx-0.5.6\pptx\package.py", line 16, in <module>
from .parts.image import Image, ImagePart
File "D:/apera/python27/python-pptx-0.5.6\pptx\parts\image.py", line 13, in <module>
import Image as PIL_Image
ImportError: No module named Image
当我想安装 PIL 时,它无法安装 64 位。有没有不需要PIL的ppt库?
最佳答案
由于与Pillow和python-pptx冲突,请删除PIL包
删除位于 C:\Users\user1\AppData\Local\Continuum\Anaconda\Lib\site-packages\或您的库所在位置的 PIL 目录
运行
pip install python-pptx
来安装Pillow
关于python - python导入pptx库出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28017942/