模块“pyautogui"尽管在终端中成功安装,但未正确导入 [英] Module "pyautogui" is not importing correctly despite installing successfully in terminal
问题描述
如果是在当前使用的python环境中,打开Command Palette并选择Developer: Reload Window,问题应该会消失:
Terminal saying pyautogui is already installed, yet not recognizing it as a command
Code throwing error: Import "pyautogui" could not be resolved
Disclaimer: I have virtually no experience in Python except for a basic syntax course, and I'm very much a noob.
I was trying to create a spam bot as a prank for a friend based off of this video. The code is very simple, but for some reason doesn't work. The terminal says the module installed successfully, yet does not recognize it as a command, and the code throws an import error. Here's the entire code below to reproduce:
import pyautogui, time
time.sleep(5)
f = open("lol", "r")
for word in f:
pyautogui.typewrite(word)
pyautogui.press("enter")
If you want to check the module version, use the command pip show <packagename>
, you can also get its location:
If it's in current used python environment, open Command Palette and choose Developer: Reload Window, the problem should go away:
这篇关于模块“pyautogui"尽管在终端中成功安装,但未正确导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!