pygame 未在 Python 3.6.4 中导入 [英] pygame not importing in Python 3.6.4

查看:55
本文介绍了pygame 未在 Python 3.6.4 中导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要注意的是,我已经搜索并尝试了可以​​在此处、YouTube 和谷歌带我到的任何地方找到的关于此主题的所有解决方案.

运行 Windows 10 Home 64 位和 Python 3.6.4.

当我通过 print (help('modules') ) 调用所有模块的列表时,Pygame 显示为可用模块.但是当我导入它时,我得到:

from pygame.base import *

ModuleNotFoundError: 没有名为pygame.base"的模块

<块引用><块引用><块引用>

help('pygame')pygame 中的问题 - ModuleNotFoundError: No module named 'pygame.base'

我已经安装了pygame:PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts> py -m pip install pygame --user 要求已经满足:pygame in c:\users\mando\appdata\roaming\python\python36\站点包您使用的是 pip 版本 9.0.1,但是版本 9.0.3 可用.您应该考虑通过python -m pip install --upgrade pip"命令进行升级.PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts> m pip install --upgrade pip

我已按照建议更新了 pip:PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts> python -m pip install --upgrade pip 要求已经是最新的:pip in c:\users\mando\appdata\本地\程序\python\python36-32\lib\site-packagesPS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts>

我已经安装了 32 位和 64 位 whl 用于踢球,但都不起作用:pygame-1.9.3-cp36-cp36m-win_amd64.whl

当我安装它时,我得到:pygame-1.9.3-cp36-cp36m-win_amd64.whl 在此平台上不受支持.

我通过以管理员身份运行的 cmd 安装了这个.

我实际上可以运行:py -m pygame.examples.aliens应用程序打开并运行良好.我只是无法将 pygame 导入 IDLE.

任何人都可以请我指出解决方案吗?

解决方案

发现问题.我正在使用的书据说使用:py -m pip install pygame --user.那把它安装在错误的路径中.正确的命令是:pip install pygame.我删除了 pygame 文件并使用 pip install pygame 重新安装了它们,现在一切都很好.谢谢@NekoTony.我们将把这个归咎于用户错误.——

As a caveat, I have searched and tried every solution on could find on this topic here, on YouTube and anywhere google brought me to.

Running Windows 10 Home 64 bit and Python 3.6.4.

Pygame is displaying as an available module when I call a list of all modules via print (help('modules') ). But when I import it I get:

from pygame.base import *

ModuleNotFoundError: No module named 'pygame.base'

or

help('pygame') problem in pygame - ModuleNotFoundError: No module named 'pygame.base'

I have have installed pygame: PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts> py -m pip install pygame --user Requirement already satisfied: pygame in c:\users\mando\appdata\roaming\python\python36\site-packages You are using pip version 9.0.1, however version 9.0.3 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts> m pip install --upgrade pip

I have updated pip as recommended: PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts> python -m pip install --upgrade pip Requirement already up-to-date: pip in c:\users\mando\appdata\local\programs\python\python36-32\lib\site-packages PS C:\Users\mando\AppData\Local\Programs\Python\Python36-32\Scripts>

I have installed both 32 and 64 bit whl for kicks, but none work: pygame-1.9.3-cp36-cp36m-win_amd64.whl

When I install this I get: pygame-1.9.3-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.

I installed this via cmd running as an administrator.

I can actually run: py -m pygame.examples.aliens The application opens and runs fine. I just cannot import pygame into IDLE.

Can anyone please point me to a solution?

解决方案

Found the issue. The book I am using said to use: py -m pip install pygame --user. That installed it in the wrong path. The correct command is: pip install pygame. I deleted the pygame files and reinstalled them with pip install pygame and all is well now. Thanks @NekoTony. We'll chalk this one up to user error. –

这篇关于pygame 未在 Python 3.6.4 中导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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