0

I am trying to use openpyxl with python 3.7, but when starting my .py file in my windows shell I got the ModuleNotFoundError.

It is kinda weird as i don't get this error if I write my code in the python interpreter (can create and save .xlsx files)

I tried uninstalling and installing again via pip3 and/or running shell as admin (pip is updated). I don't use many other modules (os, wx, csv and calendar) so it shouldn't interfere. I renamed my .py file so i'm sure there is no name conflict.

import openpyxl
#from openpyxl import Workbook (doesn't work either)

Do you have an idea where this may coming from ?

regards,

Clem

Clem Mi
  • 66
  • 5
  • Do you have multiple Python versions installed? – ConSod Aug 08 '19 at 13:14
  • Nope, only 3.7 However I just found a solution, looks to be working at the moment. I will answer my question for others people who might need it :) – Clem Mi Aug 08 '19 at 17:08

1 Answers1

0

I think I found a solution, as I don't get the error anymore.

I added the encoding and language interpreter at the beginning of my .py file

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from openpyxl import Workbook

Hope it helps :)

Clem Mi
  • 66
  • 5