2017-04-16 145 views
0

我設法使用'pip install python-pptx'來安裝python-pptx 0.6.5,但是當我從「pptx import Presentation」中導入時,它報告了錯誤。任何人都可以幫助我嗎?錯誤報告如下:爲什麼我不能在Python 3.5中導入pptx包

Traceback (most recent call last): 
    File "Course_1.py", line 1, in <module> 
    from pptx import Presentation 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pptx/__init__.py", line 15, in <module> 
    from pptx.api import Presentation # noqa 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pptx/api.py", line 17, in <module> 
    from .package import Package 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pptx/package.py", line 13, in <module> 
    from .opc.package import OpcPackage 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pptx/opc/package.py", line 13, in <module> 
    from .oxml import CT_Relationships, serialize_part_xml 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pptx/opc/oxml.py", line 12, in <module> 
    from lxml import etree 
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/lxml/etree.cpython-35m-darwin.so, 2): Library not loaded: libxml2.2.dylib 
    Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/lxml/etree.cpython-35m-darwin.so 
    Reason: Incompatible library version: etree.cpython-35m-darwin.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0 

回答

-1

試試吧周圍的其他方法:這不是問題from pptx import Presentation

+0

。這只是一個錯誤的問題。如果代碼真的是這樣,堆棧跟蹤將完全不同。 –