模块“pyautogui"尽管在终端中成功安装,但未正确导入 [英] Module "pyautogui" is not importing correctly despite installing successfully in terminal

查看:175
本文介绍了模块“pyautogui"尽管在终端中成功安装,但未正确导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果是在当前使用的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆