FinnK
FinnK

Reputation: 210

Why do I get ModuleNotFoundError while importing docx?

I'm trying to import Document from docx but with this ModuleNotFoundError occures.

from docx import Document

# just for testing:
doc = Document()

When running this I am getting folowing output:

Traceback (most recent call last):
  File "C:/Users/finnm/PycharmProjects/MesseMahlzeiten/TestScipt.py", line 1, in <module>
    from docx import Document
ModuleNotFoundError: No module named 'docx'

Since it may could be helpful I show you what pip-installation outputs:

C:\Users\finnm>pip install python-docx
Collecting python-docx
  Using cached https://files.pythonhosted.org/packages/e4/83/c66a1934ed5ed8ab1dbb9931f1779079f8bca0f6bbc5793c06c4b5e7d671/python-docx-0.8.10.tar.gz
Requirement already satisfied: lxml>=2.3.2 in c:\users\finnm\appdata\local\programs\python\python36\lib\site-packages (from python-docx) (4.4.1)
Installing collected packages: python-docx
  Running setup.py install for python-docx ... done
Successfully installed python-docx-0.8.10

Upvotes: 0

Views: 375

Answers (1)

FinnK
FinnK

Reputation: 210

Solved

I was able to pip install python-docx by doing pip-installation actually inside my script.

This question answers to it: Installing python module within code


Thanks to everyone for helping me.

Upvotes: 1

Related Questions