Pyautogui 未导入“没有名为‘pyautogui’的模块";

编程入门 行业动态 更新时间:2024-10-27 21:12:07
本文介绍了Pyautogui 未导入“没有名为‘pyautogui’的模块";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..
import pyautogui

print("hello")

运行后,我会看到以下内容:

After running this I am presented with the following:

C:\Users\Darkm\Anaconda3\envs\PythonChallenges\python.exe C:/Users/Darkm/PycharmProjects/PythonChallenges/Automation1.py
Traceback (most recent call last):
  File "C:/Users/Darkm/PycharmProjects/PythonChallenges/Automation1.py", line 1, in <module>
    import pyautogui
ModuleNotFoundError: No module named 'pyautogui'

Process finished with exit code 1

有人能帮我理解为什么我不能导入 pyautogui 吗?

Could somebody help me understand why I cannot import pyautogui?

一些背景信息:

1.) 我只有一个版本的 python (3.7.4)

1.) I only have one version of python (3.7.4)

2.) 我已经在 cmd 提示符下通过pip install pyautogui"安装了模块.

2.) I have already installed the module through "pip install pyautogui" in cmd prompt.

3.) Pyautogui 安装在 C:\Users\Darkm\Anaconda3\Lib\site-packages 下

3.) Pyautogui is installed under C:\Users\Darkm\Anaconda3\Lib\site-packages

4.) 当我进入文件 > 设置 > 项目解释器并尝试添加它时,Pyautogui 没有出现手动(只是不显示).

4.) Pyautogui does not show up when I go into file > settings > project interpreter and try to add it manually (it just doesn't show up).

5.) 多次重启电脑

此时我无法弄清楚为什么我无法导入 pyautogui,任何帮助将不胜感激!

At this point I cannot figure out why I'm unable to import pyautogui, any help would be greatly appreciated!

推荐答案

为什么会出现此错误?

因为您使用的是 PyCharm.

在 PyCharm 中,您不需要从命令提示符安装 python 包,在 PyCharm 中,您需要从 PyCharm Project Interpreter 安装 python 包.

In PyCharm you don't need to install python packages from command prompt, in PyCharm you need to install python packages from PyCharm Project Interpreter.

这里有一些可以帮助您的提示!

Here are some tips that can help you!

第 1 步:转到 PyCharm 设置并转到此目录:首选项并选择解释器设置

Step 1: Go to PyCharm settings and go to this directory: Preferences and select Interpreter Settings

截图:

第 2 步:点击这个加号图标.

Step 2: Click on this plus icon.

截图:

第 3 步:输入您的包名称并选择包.

Step 3: Type your package name and select package.

截图:

第四步:然后点击安装按钮.

Step4: Then click on install button.

第五步:点击确定

然后等待两到三分钟,然后重试.

Then wait for two to three minutes and try again.

希望它会起作用.

这篇关于Pyautogui 未导入“没有名为‘pyautogui’的模块";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-23 04:06:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1035437.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模块   Pyautogui   pyautogui   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!