简体   繁体   English

下载适用于Python 3.4的PyGame

[英]Downloading PyGame for Python 3.4

I was hoping to install PyGame on Python 3.4. 我希望在Python 3.4上安装PyGame。 So far I have downloaded: 到目前为止,我已经下载了:

pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl

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

import pygame

pygame.init()

I am using WING IDE for this, not sure if they matters or not. 我为此使用WING IDE,不确定它们是否重要。 When i enter 'import pygame' I am without error. 当我输入“ import pygame”时,我没有错误。 It is only when I enter pygame.init() that i get the following error. 只有当我输入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'

I have read some some articles about extracting the file but not sure exactly how. 我已经阅读了一些有关提取文件的文章,但不确定具体如何。

Thanks in advance 提前致谢

Maybe you installed PyGame with Python 2.7 也许您使用Python 2.7安装了PyGame

pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl

install it with Python 3.4! 用Python 3.4安装它!

On Python2.7, try 在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)

I was hoping to install PyGame on Python 3.4. 我希望在Python 3.4上安装PyGame。 So far I have downloaded: 到目前为止,我已经下载了:

pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl

The question is, your Python version is 3.4, but you downloaded the cp27 version .whl file. 问题是,您的Python版本是3.4,但是您下载了cp27版本.whl文件。 The 'cp27' is just used for Python 2.7. “ cp27”仅用于Python 2.7。

You need to download the 您需要下载

pygame‑1.9.3‑cp34‑cp34m‑win32.whl pygame‑1.9.3‑cp34‑cp34m‑win32.whl

or 要么

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

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

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