在Python中加载pptx模块时发生AttributeError

时间:2018-06-28 13:25:22

标签: python python-pptx

在尝试导入python-pptx模块时,我得到了重新出现的AttributeError

import pptx

AttributeError                            Traceback (most recent call last)
...
----> 8 import pptx.exc as exceptions
...
AttributeError: module 'pptx' has no attribute 'exc'

我正在使用JupyterNotebook,并且已经使用pip uninstall python-pptx pip install python-pptx重新安装了python-pptx。在stackoverflow上,我找到了相关的文章here

即使我了解它可能无法加载正确的模块,我也不知道如何进一步解决该问题。非常感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

您是否为程序pptx.py命名了? Python会优先加载该模块而不是库版本。

您可以在Python提示符下找到加载了哪些模块:

>>> import pptx
>>> pptx.__file__
'/somedir/.../python-pptx/pptx/__init__.pyc'

这可能有助于缩小范围。