Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pycharm doesn't recognize pygame package

I'm using mac OsX 10.8.2, pyCharm 2.7.1. python 2.7.2

I want to use pygame package with pycharm. I followed the instructions on the pygame site and installed pygame 1.9.1 successfully. When I write "import pygame" pycharm doesn't find the package.

I tried installing the latest updates of python, pycharm and pygame. I tried using the "install" window in the preferences. It installed "pygamess", "pygameui" and "pyviewx.pygame", but when I try to instal "pygame_loaders" it writes "Install packages failed: Error occurred when installing package pygame_loaders".

If you can please give simple instruction since I'm not a heavy mac-user.

like image 738
Yotam Hacohen Avatar asked Nov 25 '25 16:11

Yotam Hacohen


1 Answers

To use pygame under OS X, you need to run Python under the 32 bit interpreter. It's usually called something like 'python2.7-32', and if installed from the package on http://www.python.org/, within /usr/local/bin

To get this working in PyCharm, open a project, then preferences ('apple'-'comma'), go to 'python interpreters', and click the '+' button in the right hand pane.

A list should appear and you'll see '/usr/local/bin/python2.7-32', select that and then make it the default for your PyGame project.

If you haven't installed Python from python.org, I recommend you do so; the current version is 2.7.3.

The above setup is how I got PyGame working in PyCharm on Sunday, so it should still be valid.

like image 169
Jonathan Tullett Avatar answered Nov 28 '25 17:11

Jonathan Tullett