I am trying to import pyodbc
module on a windows computer. It works in the terminal, but not the IDLE. The error message in IDLE is:
Traceback (most recent call last):
File "FilePath/Filename.py", line 3, in <module>
import pyodbc
ImportError: No module named pyodbc
To run a file of code that we're editing in IDLE, select the file's text edit window, open that window's Run pull-down menu, and choose the Run Module option listed.
This is caused by the fact that the version of Python you're running your script with is not configured to search for modules where you've installed them. This happens when you use the wrong installation of pip to install packages.
python
and press enter)import modulename
)modulename.__file__
import sys
and typing sys.executable
to get the paths where it looks for modules to importThis method worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With