6

I wanted to compile my python program that uses pygame into an executable using py2exe but I'm experiencing some problems. I run the script in the windows command line and it seems to work. It creates a dist directory but when I try to open the .exe file, it briefly opens a command line window and then doesn't do anything.

Could this possibly be because I've used pygame and py2exe doesn't support it? Or do I need to put a copy of the pygame library into the same directory as my program?

1
  • As the answers below show, you NEED TO READ THE DOCUMENTATION, BEFORE you post. Also, try googling "compile python pygame" (without quotes), AJ00200's site is the first one that pops up... Try google first. Commented Jun 6, 2016 at 20:54

3 Answers 3

3

There is an answer to this on the pygame wiki: http://pygame.org/wiki/Pygame2exe To include pygame in the executable, you will need to edit BuildExe.__init__

Sign up to request clarification or add additional context in comments.

Comments

0

Try running the .exe from the command line to see if it's printing some kind of error message. Probably it's missing some DLLs, which you'll need to manually specify when executing py2exe.

This blog post might be useful.

1 Comment

The error message would be that the stuff that need to be imported dont exist
0

You should use PyInstaller to turn your program and its dependencies into a standalone executable
https://pypi.org/project/PyInstaller/
Using it is as simple as running pyinstaller /path/to/yourscript.py

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.