在一个文件中导入 Openpyxl 有效,但在另一个文件中 ModuleNotFoundError Comes

Importing Openpyxl in one file works but in another file ModuleNotFoundError Comes

我在我的测试 .py 文件中导入了 openpyxl。它在该文件中运行良好,但当我将其导入软件时,它显示此错误:

C:\Python39\python.exe "C:/Users/User/Desktop/Wash & Fold Laundry Billing System/main.py" Traceback (most recent call last): File "C:\Users\User\Desktop\Wash & Fold Laundry Billing System\main.py", line 5, in from openpyxl import Workbook ModuleNotFoundError: No module named 'openpyxl' Process finished with exit code 1

我已经尝试了 Whosebug、google、w3schools 和 geeksforgeeks 中的每一个问题 但是所有的答案都是徒劳的

好的,所以我尝试了所有方法,这个解决方案是最好的。

你只需要删除所有配置(pycharm)或解释器。