How to create a .exe python file in windows? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to create a .exe python file in windows?

25th Apr 2017, 8:31 PM
Simone Gramegna
Simone Gramegna - avatar
3 Answers
+ 1
Py2exe only works on Windows Go this website www.py2exe.org
25th Apr 2017, 9:25 PM
Abdullahi Yusuf
Abdullahi Yusuf - avatar
+ 1
You mean how to create a .exe FROM a python file? check out py2exe
25th Apr 2017, 11:04 PM
Bebida Roja
Bebida Roja - avatar
0
On windows, the standard python installer already associates the .py extension with a file type - python.file and give that file type an open command that runs the pythong interpreter. This is enough to make scripts executables. But if you wish to use just the name without the extension, you will have to put '.py' to the PATHTEXT environment variable. if that doesn't satisfy you, do "pip install cx_freeze" without quotes. Its for freezing python scripts into executables and it cross platform and works on anyy platform that python itself works on. It supports python 2.7 and above. EDIT: I was in a hurry, so couldn't give an example on the usage. here it goes, from cx_Freeze import setup, Executable setup(name='foo', version ='0.1', description='example for conversion', executables= [Executable('foo.py')] ) # save this as setup.py or by any other name but #that's a convention which the community follows. open the command prompt and navigate to where your setup.py is and run : python setup.py build this will create a build directory which will Jabe another directory which will Jabe everything you want alomg with the .exe file for your .py file. Note: make sure setup.py amd you python file, here foo.py are in the same directory.
25th Apr 2017, 9:27 PM
learner
learner - avatar