pythonpython-3.xms-wordpython-docxmodulenotfounderror

Python docx module ModuleNotFoundError


I am a windows 7 user with MS-Office 2016 and python 3.6.
I recently found out that you can write word documents with python. I looked on how to do that I installed the docx module:

pip install docx

But whenever i try to import the docx module i get this error:

>>> from docx import Document
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Huzefa\AppData\Local\Programs\Py
in <module>
    from exceptions import PendingDeprecationWarn
ModuleNotFoundError: No module named 'exceptions'

I have even tried this but it wont work:

pip install exceptions

I get this error:

ERROR: Could not find a version that satisfies the requirement exceptions (from versions: none)
ERROR: No matching distribution found for exceptions

I thought that maybe this is happening because docx is a python-2 module but it is not. I found it out here

so can someone tell me what i am doing wrong?


Solution

  • try using:

    pip install python-docx
    

    It worked for me!