How to Convert Python to Exe and Create An Installer

preview_player
Показать описание
Converting Python files to executable and eventually creating an installer. Coding in Saskatchewan with Martian Marty.

Python cx_Freeze download link:
Рекомендации по теме
Комментарии
Автор

Hello ! Nice video but i have a problem :(
When i execute my application in the build folder, a cmd windows open and get closed one second after :/
(I have three .py file and my datas that i moved in the build folder)

madkwad
Автор

i'm impressed with the production quality and how actually good this video is.

haekalalghifary
Автор

Great video. Easy to follow, to the point, and you explained everything well. Thanks for the upload!

shinobi
Автор

Great vid Marty - I have spent the last two days looking for how to compile a python program that included images and sounds - where they all failed - you have delivered - nice work.

danmurphy
Автор

Thanks. I could not make an executable with pyinstaller, but it works with this way. I'm glad that you made this video. I little detail which would make me happier. Please next time when you write a code, please zoom in, when you edit it, because I just in full screen can see everything, and I wasn't able to write it simuntaniously. Thanks again :)

MRZN
Автор

import cx_Freeze
from cx_Freeze import *

setup(
name = "Forcefighter",
options = {"build_exe":{"packages":['pygame']}},
executables=[
Executable(
"main.py",
)
]
)

Zuschauerquaeler
Автор

SUPER VIDEO MARTY THANQ FOR THIS VIDEO

infetoreoxstudios
Автор

thank you so much this actually i finally found a tutorial that works with pygame and other files

shadmilkgod
Автор

I think only importing cx_Freeze doesn't work because only importing cx_Freeze will import the main package file, but when we import * from cx_Freeze, it will import all the class files made in the package
I think this happens, I'm also not much sure

vaibhavkrkm
Автор

I was really looking for this..and :
Omg that Thanks a lot from my

vaibhavkrkm
Автор

Thank you very much! I have 2 questions:
1.Can I pack python itself with the installation, so the user won't need to download it separately?
2.Can it work for a machine learning code which uses a cvs files to work? If it is possible, are there any differences in the way I do it?

remix_il
Автор

Hi codergopher, that's an excellent video, but I have a query. Is it applicable for python2.7 also? I am using python2.7 and trying to convert one file into executable but it's showing an error in the line 'executables' as invalid syntax. Could you please help me with it? Is there any problem with lower or upper case?

awhimsicaljourney
Автор

I did it with only one library and it worked, but with two or more isn't working for me... this is the code:
[ build.bat ]
py Setup.py build

[ Setup.py ]
import cx_Freeze
from cx_Freeze import *

setup(
name = "Test",
options = {'build_exe':{'packages':['alisuretool', 'json5']}},
executables = [
Executable(
'Test.py',
)
]
)

[ Test.py ]
import alisuretool
import json5
print('Success')
while True:
pass

What should happen is the cmd saying 'success', but it closes before both the print and the loop, so I think the problem are the two imports. (I tried with pretty much the same setup but with one and it works perfectly). Any kinda help is appreciated :)
EDIT: I can see two folders named as the two libraries ('alisuretool' and 'joson5') and there are files in them. The path to these folders is: build/exe.win-amd64-3.8/lib/

stefanolassandro
Автор

It can be done for all type of py programme??
On which I don't use graphical library etc.

ravindrachouhan
Автор

If you send it to your friend and his/her computer doesnt have any applications required will the app run?

rizaldycesarquimno
Автор

I’ve tried this but whenever I download Freeze it says something is missing and to install it again

josephward
Автор

Is it necessary to install Visual C++14 build tools?, coz its 4 gb, And Will it combine my 4 py files into a single package, ?? I tried other methods but the error comes when my main.py file imports other .py file..
So will Your method work in my case??

HimanshuSharma-ovcu
Автор

what file do i share to make it work? (i cant just share the exe because i have pygame and images)

shadmilkgod
Автор

This may be a dump question, but does the user need to have python installed to run the batch file as an installer? I am assuming it calls the setup.py file that needs python to run.

TerrenceThurk
Автор

I got this error after trying to run the python setup file:

SystemExit: usage: python_setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: python_setup.py --help [cmd1 cmd2 ...]
or: python_setup.py --help-commands
or: python_setup.py cmd --help

error: no commands supplied

How do I fix it? Thx.

Sengramou
welcome to shbcf.ru