user163505
user163505

Reputation: 509

Can not import Pygame

I am trying to install and use PyGame. I am using Python 3.3.2 and Pygame "3.3 pygame-1.9.2a0" according to the installer. I downloaded it from https://bitbucket.org/pygame/pygame/downloads. I used an easy install, and after next-next type install, I opened the Python 3.3.2 Shell and typed "import pygame". I got this error:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
ImportError: No module named 'pygame'
>>> import sys; print sys.path
SyntaxError: invalid syntax

I am also trying to install it with the PyCharm IDE, but I have NO clue how to do that either. The installer I'm using may be for 32 bit, which wouldn't be compatible with my 64 bit installation of Python, but I don't know how to tell and if so is there even a 64 bit version of PyGame for 64 bit? If anyone knows how to install PyGame for Python 3.3.2 please let me know. Thank you for your time.

Upvotes: 1

Views: 25369

Answers (4)

LMCuber
LMCuber

Reputation: 113

Ever time I use PyCharm, I go to File > Settings > Project: (project name) > Interpreter > Plus Icon > (search pygame and click install package) This is because I think that you are using a pycharm venv and I think that that isolates outer packages so I do it this way

Upvotes: 0

octref
octref

Reputation: 6801

From pygame website:
windows 64bit users note: use the 32bit python with this 32bit pygame.
So either donwload a 32bit python, then install with the 32bit pygame installer, or download the unofficial 64bit pygame build at here.

Upvotes: 0

shad0w_wa1k3r
shad0w_wa1k3r

Reputation: 13373

Currently, pygame is not available for 64 bit Python (or so it seems on Pygame Site).
The one you installed maybe 32 bit & thus causing the ImportError.

In Python 3.x, print is a function & hence the SyntaxError.

Pycharm for Python 3.x is available Pycharm Download

I would recommend using Python 3.x (32 bit) because most of the libraries seem to be compatible with it & also, 64 bit version doesn't provide much performance benefit as such. I personally use PyScripter IDE

This maybe very handy at times - Very useful precompiled binaries for several libraries

Upvotes: 0

yuvi
yuvi

Reputation: 18457

If your python is a 64 bit version the binary install for the 32 bit will not work. However, there is a 64 bit version here:

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

If you're worried because they're unofficial don't. I have used many installations from that link for my 64 bit python and they're working great.

Upvotes: 1

Related Questions