在 Python 中加载 pptx 模块时出现 AttributeError
AttributeError when loading pptx module in Python
我在尝试导入 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。在Whosebug上,我找到了一个相关的post here。
即使我知道它可能没有加载正确的模块,我也不知道如何进一步处理以解决问题。非常感谢帮助。
您是否偶然将您的程序命名为 pptx.py
? Python 将优先加载该模块而不是库版本。
您可以在 Python 提示符下找出加载了哪个模块:
>>> import pptx
>>> pptx.__file__
'/somedir/.../python-pptx/pptx/__init__.pyc'
这可能有助于缩小范围。
我在尝试导入 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。在Whosebug上,我找到了一个相关的post here。
即使我知道它可能没有加载正确的模块,我也不知道如何进一步处理以解决问题。非常感谢帮助。
您是否偶然将您的程序命名为 pptx.py
? Python 将优先加载该模块而不是库版本。
您可以在 Python 提示符下找出加载了哪个模块:
>>> import pptx
>>> pptx.__file__
'/somedir/.../python-pptx/pptx/__init__.pyc'
这可能有助于缩小范围。