Jump to content

Making it Standalone from Source Code (Python)

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
8 replies to this topic

#1
annannienann

annannienann

    Newbie

  • Members
  • PipPip
  • 11 posts
I have written my source code and it works like a dream. It's tested, documented and optimized. However, I lack one piece of fundimental knowelgde. How do I turn my python source code into a stand alone application (for windows) that is simply an icon on the desktop that you click?

Thanks Peter.

#2
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
That is a sometimes complicated task to do. Pythonscripts always requires Python to be installed, so when you are making an executablefile, then the executable will contain all the necessarily Python to make it run. It makes the executable both slow and big.

When that's said, here's a link:
FrontPage - py2exe.org

#3
annannienann

annannienann

    Newbie

  • Members
  • PipPip
  • 11 posts

v0id said:

That is a sometimes complicated task to do. Pythonscripts always requires Python to be installed, so when you are making an executablefile, then the executable will contain all the necessarily Python to make it run. It makes the executable both slow and big.

When that's said, here's a link:
FrontPage - py2exe.org

Thanks void, you really hit the nail on the head. I am currently pulling together all the techo know how to create my unit 6 course work for computering A2. You also led me to another website that allowed me to create installers easily so two birds with one stone there. Thanks.

#4
Victor

Victor

    Programmer

  • Members
  • PipPipPipPip
  • 116 posts
Py2exe is an excellent choice to convert .py to .exe. However, I would like to recommend Pyinstaller, it will make a single exe with everything needed to work. You won't have to distribute a whole directory, also, Pyinstaller's output is consistently smaller in size than Py2exe. They both have plenty of solid features and are fairly easy to figure out.

Also, if you're looking for an installer, I recommend NSIS with HM NIS Editor. I couldn't stand the language of NSIS but when I got HM NIS, it was much easier, smaller, more compact installers too.

#5
Matt

Matt

    Learning Programmer

  • Members
  • PipPipPip
  • 47 posts
Anyone know of any tools like these for making Linux executables?

#6
Matt

Matt

    Learning Programmer

  • Members
  • PipPipPip
  • 47 posts
Anyone know of any tools like this for creating Linux executables?

#7
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
I don't know a way to make a Python-script to a "real" executable file. But you could cheat, a little, and do this.
Put this in the top of your Python document:
#!/usr/bin/env python
Then you can chmod'e it, to make it executable:
chmod +x your_file.py
I've heard the new official Python-package comes with a new program, exemaker. I don't know if it's able for Linux, but in Windows it should be able to generate executable-files pretty easy.

#8
Victor

Victor

    Programmer

  • Members
  • PipPipPipPip
  • 116 posts
I read that most Linux OSs have Python built-in. However, I did find a post on a different forum that suggested something called 'python-eggs'. I don't use Linux (yet) but maybe this can help you out.

A py2exe like tool for Linux - Python
Python Eggs

Also, v0id, do you know if the size of the .exe's has improved over Py2exe or Pyinstaller?

#9
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
No, I don't know. I don't really know anything about neither of them, because I haven't really worked with them. If you're thinking about making the executable smaller, then it's possible with other alternatives.

GCC have a small program called "strip," which removes all unnecessary information from an executable file. Start out by converting the Python script to an executable file, and then do this:
strip your_executable_file.exe