问题
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
回答1:
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 :)
来源:https://stackoverflow.com/questions/57396896/fixing-module-not-found-error-when-importing-openpyxl-in-py-file