如何解决ModuleNotFoundError: 没有名为“pyautogui”的模块
我尝试在 Visual Studio 中安装 pyautogui,但每当我运行以下程序时:
import subprocess
import pyautogui #pylint: disable=E0401
import time
import pandas as pd #pylint: disable=E0401
from datetime import datetime
def sign_in(meetingid,pswd):
# Opens up zoom app
subprocess.call(r"C:\Users\krish\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Zoom")
sign_in('6931145146','SKS123')
我收到以下错误:
File "c:\Users\krish\Desktop\AUTOBOT\Zoom Auto Attender",line 2,in <module>
import pyautogui #pylint: disable=E0401
ModuleNotFoundError: No module named 'pyautogui'
我尝试了可用的解决方案 import error for pyautogui
但它不起作用,所以请帮忙。
解决方法
根据您的描述,请参考以下内容:
-
请在 VS Code 终端中使用命令“
python --version
”或“pip --version
”来检查 VS Code 终端当前使用的 python 是否与显示在VS Code 的左下角。(如果不一致,请使用快捷键Ctrl+Shift+`打开一个新的VS Code终端,它会自动进入选中的环境。)
-
检查模块的安装。 (
pip show pyautogui
)VS Code识别python模块的位置在当前使用的python环境的“
\Lib\site-packages\
”中。
运行:
参考:Python environments in VS Code。
,您可能需要安装 pyautogui 的包
https://pyautogui.readthedocs.io/en/latest/
pip install pyautogui
你确定你不在 venv(virtual environment) 中,如果不是这样的话
手动安装 .whl 文件,请访问此站点 https://www.lfd.uci.edu/~gohlke/pythonlibs/
并下载轮子文件。
然后在cmd或终端输入
pip install 'where u have stored the .whl file
应该做的工作
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。