首页 > 解决方案 > 如何在 python 模块 docx 中导入文档?

问题描述

嗨,我正在使用 mac 并使用 pip 安装 python-docx。我进入 C:\Python27\Scripts 并运行

pip install python-docx

我认为它应该已经安装了。

但是当我运行一个简单的导入

from docx import Documents

它遇到了一个

"ImportError: No module named docx" when i checked the modules installed using pip using ```pip list``` python-docx 0.8.11 is installed. 

有谁知道为什么会这样?

标签: pythonpython-2.xdocxpython-docx

解决方案


请尝试安装python-docx

$ pip uninstall docx
$ pip install python-docx

推荐阅读