简体   繁体   中英

error importing pptx library python

i want to import pptx but i'm using this

import sys

sys.path.insert(0,'D:/apera/python27/python-pptx-0.5.6')

import pptx

but somehow it shows error like this

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

and when i want to install PIL it can't install for 64 bit. Is there a ppt library that don't need PIL?

remove the PIL package due to conflicts with Pillow and python-pptx

  • Delete the PIL directory located in C:\\Users\\user1\\AppData\\Local\\Continuum\\Anaconda\\Lib\\site-packages\\ or wherever your library is

  • run pip install python-pptx to install Pillow

I had about the same issue. When I updated the pillow library (pretty easy to do with Anaconda which I use) the issue was gone.

  1. Uninstall Pillow

  2. Uninstall python-pptx

  3. Install Pillow

  4. Install python-pptx

Run above commands using "pip". This worked for me.

I meet the same question My system is windowXP 32bit and python is 2.7.13 I just to degrade the version of pillow and python-pptx. It works for me pip install pillow==3.1.0 pip install python-pptx==0.5.5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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