Jump to content

  • Log In with Google      Sign In   
  • Create Account

How to use pygame when running python through sublime text 2?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 ZorionBakar   Members   -  Reputation: 105

Like
0Likes
Like

Posted 02 May 2013 - 11:35 AM

Every time I try to run a program that imports pygame through Sublime Text it says: ImportError: No module named pygame.

 

How do I import pygame if I'm running the file on Sublime Text?

 


Sponsor:

#2 ColinDuquesnoy   Members   -  Reputation: 1127

Like
0Likes
Like

Posted 02 May 2013 - 12:20 PM

Do you have pygame installed?

 

Does it work when you use the interactive interpreter?


Edited by renega_666, 02 May 2013 - 12:54 PM.


#3 tp9   Members   -  Reputation: 532

Like
0Likes
Like

Posted 02 May 2013 - 01:46 PM

Your pygame folder needs to be installed in the folder where your current python version is installed. Here is my setup:

 

C:\Python27\include\pygame\

 

When you install pygame it will ask you to select the version of python to install to. You also need to verify that C:\Python27 is in your path system variable if you are using windows.



#4 ZorionBakar   Members   -  Reputation: 105

Like
0Likes
Like

Posted 02 May 2013 - 02:17 PM

I have pygame installed.  I have no idea where the files went or how to find them.  There is no include folder in my Python 2.7 folder.  I'm running Python 2.7 on a mac 10.8 os x.

 

Pygame works in IDLE just not when I try to launch it through Sublime Text.


Edited by ZorionBakar, 02 May 2013 - 02:18 PM.


#5 tp9   Members   -  Reputation: 532

Like
0Likes
Like

Posted 02 May 2013 - 05:15 PM

Are there any other versions of Python on your computer?



#6 swiftcoder   Senior Moderators   -  Reputation: 9997

Like
2Likes
Like

Posted 02 May 2013 - 05:19 PM

My guess would be that Sublime's console uses its packaged copy of Python 3.x, rather than the system Python (which was Python 2.7, last I checked).

 

If I am correct, then you would need to figure out which directory Sublime keeps its python extensions in, and install a Python 3.x-compatible version of PyGame to that directory.


Edited by swiftcoder, 02 May 2013 - 05:20 PM.

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS