[英]Can't install pygame on pycharm
I've successfully installed pygame on my computer.我已经在我的电脑上成功安装了 pygame。 When I type "import pygame" there is no error so that means that pygame is installed on my laptop.
当我输入“import pygame”时没有错误,这意味着我的笔记本电脑上安装了 pygame。 But, when I type the same thing on Pycharm, I get the following error:
但是,当我在 Pycharm 上键入相同的内容时,我收到以下错误:
ModuleNotFoundError: No module named 'pygame'
ModuleNotFoundError:没有名为“pygame”的模块
I have initialized pygame, so that's not the problem.我已经初始化了 pygame,所以这不是问题。 I've also tried to install pygame from pycharm and I get this error every time I try to install it:
我还尝试从 pycharm 安装 pygame ,每次尝试安装时都会出现此错误:
I've tried everything.我什么都试过了。 The interpreter is correct, too.
翻译也是正确的。 How can I proceed?
我该如何进行?
Probably you're using two different python interpreters on your pycharm and on your terminal.可能您在 pycharm 和终端上使用了两个不同的 python 解释器。
Please,请,
check the python version on the terminal by python3 --version
通过
python3 --version
在终端上检查 python 版本
And then go to pycharm -> file -> settings -> project -> project interpreter然后 go 到 pycharm -> 文件 -> 设置 -> 项目 -> 项目解释器
and check if both python are the same.并检查 python 是否相同。
sudo easy_install-3.8 pygame
(This will install the dependencies.) (这将安装依赖项。)
sudo pip3 install pygame
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.