0

So I have a python code now that I want other folks to use. They don't have Python installed on their computers. I have seen people convert their code to .exe so others can use it even if they don't have Python on their machines.

How can I do this? Is there a special software needed for this?

Thank you

rmore911
  • 195
  • 2
  • 13

1 Answers1

0

Use the pyinstaller library. Then you can create the file with

pyinstaller --onefile yourFileName.py
Henrique Branco
  • 1,778
  • 1
  • 13
  • 40
  • I installed pyinstaller and used the above line of code. I think it went through (I did not get any errors). But I am unable to locate the .exe file now. There is an 'Application' file by the same name of my project in the 'dist' folder. When I double click on it it opens as myProjectName.exe but eventually it says - failed to run script myProjectName.exe and the window closes – rmore911 Mar 24 '20 at 04:14
  • Could you send any print screen from your error? Eventually, you have to navigate to the script´s folder in order to execute the command line correctly and generate the .exe file. – Henrique Branco Mar 24 '20 at 13:01
  • Have you put the right extension .py in your command? This error may mean that the file is trying to execute myProjectName.exe instead of myProjectName.py. Could you also check it? – Henrique Branco Mar 24 '20 at 13:04
  • I saved my project as a .py in the Python38\Scripts folder. In cmd prompt I then navigated to this folder. Then I used the - pyinstaller --onefile -w projectname.py command. ' 59157 INFO: Building EXE from EXE-00.toc completed successfully.' this is what I then got. There also is a 'dist' and a 'build' folder now. I went into the dist folder where there is the myProject application file. When I double click on it now it just straightaway gives a fatal error: Failed to execute script myProject – rmore911 Mar 24 '20 at 13:56
  • I need more information about your error. Just try to record your screen while you execute the .exe file. Recording because the execution it´s too fast and maybe you cannot read clearly the error. – Henrique Branco Mar 25 '20 at 10:49