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

huangapple go评论81阅读模式
英文:

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

问题

我现在遇到了PyAutoGUI的问题。我已经将它安装在以下路径:

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

但是VS Code似乎无法识别它。

我收到了以下消息:

无法从源中解析导入 "pyautogui"

我已经尝试重新安装所有内容,设置路径并验证安装。

英文:

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.

答案1

得分: 0

使用<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> --> 选择 Python:选择解释器 来选择正确的解释器。

如果您的计算机上有多个Python版本,您需要选择已安装pyautogui包的版本。

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

您可以使用以下代码检查当前解释器路径。

import sys
print(sys.executable)
英文:

Use <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> --> 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.

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

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

import sys
print(sys.executable)

huangapple
  • 本文由 发表于 2023年1月9日 01:42:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75050024.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定