繁体   English   中英

下载适用于Python 3.4的PyGame

[英]Downloading PyGame for Python 3.4

我希望在Python 3.4上安装PyGame。 到目前为止,我已经下载了:

pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl

来自http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

import pygame

pygame.init()

我为此使用WING IDE,不确定它们是否重要。 当我输入“ import pygame”时,我没有错误。 只有当我输入pygame.init()时 ,才会出现以下错误。

  File "C:/Users/mount_000/Desktop/CS116/pygame-banans.py", line 3, in <module>
    pygame.init()
builtins.AttributeError: module 'pygame' has no attribute 'init'

我已经阅读了一些有关提取文件的文章,但不确定具体如何。

提前致谢

也许您使用Python 2.7安装了PyGame

pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl

用Python 3.4安装它!

在Python2.7上,尝试

Python 2.7.13 (default, Apr  4 2017, 08:47:57) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>> pygame.init()
2017-07-24 09:52:53.759 Python[1067:10041] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/7s/d087_7dx48n6mdl1ry4hw1s40000gn/T/org.python.python.savedState
(6, 0)

我希望在Python 3.4上安装PyGame。 到目前为止,我已经下载了:

pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl

问题是,您的Python版本是3.4,但是您下载了cp27版本.whl文件。 “ cp27”仅用于Python 2.7。

您需要下载

pygame‑1.9.3‑cp34‑cp34m‑win32.whl

要么

pygame‑1.9.3‑cp34‑cp34m‑win_amd64.whl。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM