Kyi Zet
Kyi Zet

Reputation: 59

ModuleNotFoundError on Python IDLE

enter image description here

The first one is that I've been having these errors since months ago. Every time I try to run these in python IDLE, it shows these kinds of errors. But it runs just fine when using terminal(python3 file-name.py). I've been anchoring interests in so many things and maybe I might have installed something unnecessary and that's bugging me.

Upvotes: 1

Views: 4258

Answers (1)

CloudEnthusiast
CloudEnthusiast

Reputation: 137

Check the python path from IDLE:

Example:

import sys
for path in sys.path:
    print(path)

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\idlelib

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python37.zip

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\DLLs

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages

List the python path where IDLE is referring

Referring IDLE outputs, Go to Scripts path in CMD (Run as Administartor):

example: cd C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts

Here, you can do pip install <module_name> Then IDLE will refer this module

Upvotes: 2

Related Questions