0

Creating a python executable in pycharm is harder than creating it in visual studio or creating a vb.net executable.

I thought I'd understand how to do this already but it looks like I have not. I created a question regarding this in Dec of last year, here >> Create a simple python executable program and an icon to it - Hello World.

But I don't understand the answer or if it was answered completely. So I did my research again and found 2 helpful sites below that helped me create python executable without visual studio involved, https://pythonhosted.org/PyInstaller/installation.html https://pythonhosted.org/PyInstaller/usage.html#using-pyinstaller.

I followed the instructions exactly:

In command line, set path to C:\Python34\Scripts, then type pyinstaller "C:\Users\Desktop\PROGRAMs\TEST22.py".

This creates a TEST22.spec file in C:\Python34\Scripts and creates a folder TEST22 in C:\Python34\Scripts\dist and in there, are the TEST22.exe. I click on this executable to run the program, it runs completely fine. But when I copied the executable to the desktop, for example, it doesn't run. It seems like in the scripts folder there are files needed to run it and when it's a stand alone program there are no file to run it. Could someone let me know an easier way to create executable and please advise me on how I could fix it when the executable is copied to desktop or anywhere else and run it ?

Community
  • 1
  • 1
Johnseito
  • 315
  • 1
  • 9
  • 24
  • I just made an edit as before I did some redundant steps. Is there a way to see what error message I get when I put it on my desktop and run it ? I see there is an error message but it's in command line that blink really quickly I can't tell what the error message is. – Johnseito May 03 '17 at 02:02
  • You can generate an [--onefile](https://pyinstaller.readthedocs.io/en/stable/usage.html#what-to-generate) executable. The default is --onedir and you need to copy across all the files with the .exe. To troubleshoot the .exe run it from a command line. This way the window (and error) stay open. – Repiklis May 04 '17 at 09:33

1 Answers1

0

Your answer lies in pyinstaller documentation. The dist folder itself is a standalone program directory. To get a single file exe with pyinstaller is not possible even thou pyinstaller has -F option for single exe since it dosnt contain data files. I would suggest use py2exe and inno setup for creating installer

JThayil
  • 21
  • 3