Search code examples
visual-studio-codepyautogui

"Import "pyautogui" could not be resolved from source" while having pyautogui installed on VS Code


I'm having trouble right now with PyAutoGUI. I have installed it in:

C:\msys64\mingw64\lib\python3.9\site-packages

but VS Code doesn't seem to recognize it.

I get this message:

Import "pyautogui" could not be resolved from source

I've already tried reinstalling everything, set paths and verify installations.


Solution

  • Use Ctrl+Shift+P --> Python:Select Interpreter to select the correct interpreter.

    If there are multiple python versions on your machine, you need to use the one that has the pyautogui package installed.

    enter image description here

    You can check the current interpreter path with the following code.

    import sys
    print(sys.executable)