1

Do you have to have pygame installed to run pygame games? I have programmed a game in pygame on my Raspberry Pi (using the Adafruit WebIDE), and I don't want to have to run it on the Pi itself, so I am planning to use it on my Windows 8 box, and I don't have pygame installed on the Windows box.

George Stocker
  • 57,289
  • 29
  • 176
  • 237
George
  • 15
  • 1
  • 3
  • 1
    To anyone who voted to close this question as off topic: It's not an off topic question. It's about Pygame, a library for building and running games on Python. The question asks how they could *take the game they programmed* and turn it into an executable. – George Stocker Mar 20 '13 at 12:43

3 Answers3

4

Yes, you need Pygame installed to run a python script with a reference to Pygame on Windows. You can always use Py2Exe to change it into an EXE file, and then you won't need Pygame installed.

I would provide more directions on how exactly to do that here, but it seems to be largely a 'spray and pray' process.

Another Stack Overflow question has dealt with alternatives to Py2Exe.

Community
  • 1
  • 1
George Stocker
  • 57,289
  • 29
  • 176
  • 237
0

Yes, for a computer to run a program, it needs to have the modules included in the program. It's like saying that you want to solve a quadratic equation but numbers do not exist yet. Especially if you want to edit it on your computer, you would need to have Pygame installed.

erdekhayser
  • 6,537
  • 2
  • 37
  • 69
  • 2
    Actually, as mentioned above, it is indeed possible to "compile" Python scripts into independent Windows executables. Please don't let my downvote discourage you. See it as a sign to do more research in the future before answering. – MechMK1 Mar 18 '13 at 23:45
0

You cannot run a python program without python installed. However you could make the program an exe file by using a certain converter. Some converters are py2exe, pyinstaller, and cx_freeze. I personally recommend cx_freeze. If you use cx_freeze you must add the line import pygame._view to your source code due to a bug.

Anthony
  • 670
  • 6
  • 20
  • George Stocker already provided the same answer a week ago. The added info about the `cx_freeze` bug is worth adding as a comment, but not as a new answer. – abarnert Mar 25 '13 at 21:53