没有名为“ pyautogui”的模块。使用PIP安装后,它出现在PIP冻结
我看过其他类似的问题,但没有得到答案。 我已经通过 pip install 安装了 pyautogui,并使用 pip freeze 检查过,当我尝试导入此模块时,出现错误“没有名为 'pyautogui' 的模块”。 我也尝试过重新启动我正在使用的 IDE(Pycharm),但我仍然不知道发生了什么。
有人有什么想法吗?
I have looked at other similar questions but I got no answer.
I have installed pyautogui through pip install and I have checked using pip freeze and when I try to import this module I get the error "No module named 'pyautogui'".
I have also tried to restart the IDE that I am using (Pycharm) and I still don't know what is going on.
Does anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在执行其他操作之前,请尝试重新启动 IDE。有时这很简单,因为模块在启动时不可用。
否则,您的
pip
安装可能在与您使用的 IDE 不同的 Python 版本下运行。有些计算机预装了 python,有些 IDE 可能会安装新版本作为依赖项,因此您最终可能会得到两个(或更多)不同的 python 副本。最简单的解决方案可能是从 Pycharm 中安装软件包,它将使用相同的 python 副本:https://www.jetbrains.com/pycharm/guide/tips/install-and-import/#:~:text=PyCharm%20can%20do%20both.,根据%20to%20your%20project%20styles< /a>.
或者,您可以尝试打开 python 解释器并在那里导入模块:
如果这也失败,则通过运行以下命令在 shell 中安装 pyautogui
可能会解决问题,如果您的 IDE 使用与上相同的安装您的
$PATH
,但与pip
不同。如果这不起作用,那么您将需要弄清楚在哪里使用了哪些 python 安装。
Before doing anything else, try restarting your IDE. Sometimes it's as simple as the module wasn't available when it started up.
Otherwise, it is possible that your
pip
installation is running under a different version of python than the IDE you are using. Some computers come with python pre-installed, and some IDEs might install a new version as a dependency, so you can end up with two (or more) different copies of python.The easiest solution is probably going to be to install the package from within Pycharm, which will use the same copy of python: https://www.jetbrains.com/pycharm/guide/tips/install-and-import/#:~:text=PyCharm%20can%20do%20both.,according%20to%20your%20project%20styles.
Alternatively, you can try opening the python interpreter and importing the module there:
If that also fails, then installing
pyautogui
in the shell by running:might solve it, if your IDE uses the same installation that is on your
$PATH
, but not the same aspip
.If that doesn't work, then you're going to need to figure out which python installations are being used where.