admin管理员组

文章数量:1414908

When I try to import docx, I get this error:

Traceback (most recent call last):
  File "C:\Users\kinga\PycharmProjects\InvoiceGenerator\main.py", line 8, in <module>
    import docx
ModuleNotFoundError: No module named 'docx'

and shows this on Command Prompt (I am using JetBrains' PyCharm IDE on Windows operating system)

I tried

pip install python-docx

but it didn't work.

edit: importing via "from docx import Document" yields this

Traceback (most recent call last): File "C:\Users\kinga\PycharmProjects\InvoiceGenerator\main.py", line 8, in from docx import Document File "C:\Users\kinga\PycharmProjects\InvoiceGenerator.venv\Lib\site-packages\docx.py", line 30, in from exceptions import PendingDeprecationWarning ModuleNotFoundError: No module named 'exceptions'

When I try to import docx, I get this error:

Traceback (most recent call last):
  File "C:\Users\kinga\PycharmProjects\InvoiceGenerator\main.py", line 8, in <module>
    import docx
ModuleNotFoundError: No module named 'docx'

and shows this on Command Prompt (I am using JetBrains' PyCharm IDE on Windows operating system)

I tried

pip install python-docx

but it didn't work.

edit: importing via "from docx import Document" yields this

Traceback (most recent call last): File "C:\Users\kinga\PycharmProjects\InvoiceGenerator\main.py", line 8, in from docx import Document File "C:\Users\kinga\PycharmProjects\InvoiceGenerator.venv\Lib\site-packages\docx.py", line 30, in from exceptions import PendingDeprecationWarning ModuleNotFoundError: No module named 'exceptions'

Share Improve this question edited Feb 21 at 5:15 Arjun Ravendran asked Feb 21 at 3:15 Arjun RavendranArjun Ravendran 112 bronze badges 1
  • You can run this command in your terminal or command prompt to check if python-docx is installed: pip show python-docx. Refer to https://pip.pypa.io/en/stable/cli/pip_show/ – Kepler452B Commented Feb 21 at 3:50
Add a comment  | 

1 Answer 1

Reset to default 0

How about this way of importing? "from docx import Document" [1]: https://python-docx.readthedocs.io/en/latest/

本文标签: Errors while importing pythondocxStack Overflow