Docx缺少属性

Mis*_*owa 2 python docx python-2.7

我正在尝试使用python中的docx库来考虑word文档.问题是,无论我导入什么,我都会得到关于'无属性'的错误消息.例如 - 文件

from docx import Document
Run Code Online (Sandbox Code Playgroud)

给出输出

cannot import name Document
Run Code Online (Sandbox Code Playgroud)

并且任何尝试使用Document都会以错误结束

AttributeError: 'module' object has no attribute 'Document'
Run Code Online (Sandbox Code Playgroud)

任何语法似乎都是正确的.我正在使用docx模块版本0.2.4.

谢谢你的帮助.

Smo*_*tor 7

我遇到了类似的问题.我pip install docx在我的虚拟环境中使用过.修复就是pip uninstall docx然后pip install python-docx.