Making an exe from a python script

+1 Steve Medley · March 1, 2015
Anyway to turn these python scripts I'm learning in the tutorials into an exe through PyCharm? I searched google and only found py2exe which I can't figure out at all.

Post a Reply


- page 1
Oldest  Newest  Rating
+1 alex constantin · March 1, 2015
For py2exe, do this:
In the same directory as your main script file, make a file and write this:

from distutils.core import setup
import py2exe

setup(console=['']) #replace for whatever is your main script

Then, in command prompt, type in: cd REPLACEFORDIRECTORY
When you are in the directory, type this in in command prompt: 
python py2exe

Then it will start building the program and will create two new directories, build and dist. Go into dist, and you should have the exe application. Good luck
+1 alex constantin · March 1, 2015
Lol, not sure what the link is to, probably a combination of characters, after the closing square bracket ] there is a closing parentheses )
0 Tatrasiel R · March 1, 2015
I personally use cxfreeze as you can get down to a single binary with out all the messy dlls .

import sys
from cx_Freeze import setup, Executable

   name = "On Dijkstra's Algorithm",
   version = "3.1",
   description = "A Dijkstra's Algorithm help tool.",
   executables = [Executable("", base = "Win32GUI")])

use the command prompt (cmd) to run python build from the folder containing the file.

There is a simpler way now I believe you can just have your code get passed to the build script in the cx freeze directories .

Ah here is a YT video on this.
+1 alex constantin · March 1, 2015
Wasn't aware of cxfreeze. Is it only for exe or will it do .app on Mac?
0 Tatrasiel R · March 1, 2015
I doubt it. However, You may clarify any doubts through asking the oracle google.
+1 alex constantin · March 1, 2015
I just searched. For Mac OS, cx_freeze does not work "nicely" (not very sure what they mean) but py2exe creators have also made a py2app module, which works the same for Mac.
0 Tatrasiel R · March 13, 2015
I haven't made anything for OSX regarding this, as it runs python almost natively.

Since you've found this, then I think you should take the responsibility to document your findings and show how it works for others.
0 Miroslav Zivkovic · March 18, 2015
I have one newbie question: Can i run .exe script that i made in python on other computer that doesn't have python installed?
0 alex constantin · March 18, 2015
If you have converted to .exe I am supposing you should because the .exe contains all the necessary python packages. If not, please tell me because I am very curious
+1 Tatrasiel R · March 19, 2015
Miroslav Zivkovic 
Firstly, I like name.
Secondly, that is the point of creating an executable. As long as you have a processor that can handle the instructions provided in the executable.

@ Alex,
The executable will have everything to run the file.
  • 1
  • 2



This section is all about snakes! Just kidding.

Bucky Roberts Administrator