簡體   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