0
votes
import pygame

My code is not working. I have downloaded pygame for python 2.7. Most pages I looked at, recommended reinstalling python, pygame or both.I did this and it did't work. Also people recommended changing the system from 32 bit to 64 bit or the other way around. I did that to. I tried this:

import platform
platform.architecture()
import pygame

I even tried this all in python 3.5 but I keep getting the same error.

Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- >>packages/pygame/init.py", line 95, in from pygame.base import * ImportError: >>dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site->>packages/pygame/base.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site->>packages/pygame/base.so: no matching architecture in universal wrapper

or sometimes this:

File "/Users/yulianasameroynina/Documents/python programs/gaming.py", line 3, in >> import pygame ImportError: No module named 'pygame'

when I use Pycharm, otherwise I get the first error weather I use Pydev or IDLE.

Thanks

1
downloaded via pip? - Joshua Nixon
How did you download pygame? Did you use a package manager or just downloaded it? If you just downloaded it, you probably have to run python setup.py install - Max Paymar
I just went on the site and downloaded. - lion coder
seems odd that you mention both python-2.7 and python3.5, but the Traceback appears to be using only python2.7 - the target installation should focus on only one version of python 2 or python 3, at least until it works on one version. Also, mention of both 32-bit and 64-bit seems odd, one machine should have only one architecture. - chickity china chinese chicken
On second read, the paths in the Traceback suggest the platform is Mac, I don't know if 32-bit Macs are still common (would be helpful to confirm which it is How to check whether my Intel-based Mac is 32-bit or 64-bit) then download the appropriate version from pygame.org/download.shtml. <-- Is this the site you downloaded from, if so, which version did you download? - chickity china chinese chicken

1 Answers

0
votes

This looks like you are just using an old version of pygame. Try uninstalling the one you have now, and reinstalling it using pip. As to the ImportError Pycharm is giving you, this is just because Pycharm doesn't have the right sys.path, which you might be able to change in settings.