pythonvisual-studio-codepippyodbcmodulenotfounderror

ModuleNotFoundError after installing pyodbc with pip in VSCode


I keep getting ModuleNotFoundError after installing pyodbc using pip in VSCode.
This has happened a few times before, e.g. after installing pygame, but after a few times it somehow works. This time it is not working at all.

I tried


Solution

  • Maybe you really installed the pyodbc package, but you don't necessarily use the python environment where the pyodbc package is installed.

    Solution:

    Ctrl+Shift+P --> Python: Select Interpreter --> selects the correct interpreter.

    Don't forget to use the Python extension to execute the script (Run Python File).