Jordan
Jordan

Reputation: 7

Downloading PyGame for Python 3.4

I was hoping to install PyGame on Python 3.4. So far I have downloaded:

pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl

from 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. When i enter 'import pygame' I am without error. It is only when I enter pygame.init() that i get the following error.

  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

Upvotes: 0

Views: 1726

Answers (2)

youDaily
youDaily

Reputation: 1384

I was hoping to install PyGame on Python 3.4. So far I have downloaded:

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. The ‘cp27’ is just used for Python 2.7.

You need to download the

pygame‑1.9.3‑cp34‑cp34m‑win32.whl

or

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

Upvotes: 1

GoingMyWay
GoingMyWay

Reputation: 17468

Maybe you installed PyGame with Python 2.7

pygame‑1.9.3‑cp27‑cp27m‑win_amd64.whl

install it with Python 3.4!

On Python2.7, try

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)

Upvotes: 1

Related Questions