What is it?
By now, you will probably have created a Python program that you may then wish to share with others. They may not have Python and therefore the program will not run or they may have to install Python and all the required modules first. This can be a stalling point and stop others from using your program. There are however several packages that are available that will create a distributable file that will work on Windows, Mac or Lunix operating systems. Your program can operate as a stand alone application or as an installable piece of software.
This section covers how to install and use cx_Freeze to create a stand-alone or installation version of your Python program. First download the cx_Freeze version for your computer, make sure it is the correct version for the version of Python that you code with and the 32 or 64 bit compatibility.
The easiest way the use the cx_Freeze is to run it from the command line, this requires you to add Python to the command line so that you can access an use it from the command line. Basically the simple instructions are to open the ‘advanced system settings’ (windows 7 search) Control Panel, Systems and Security settings, Systems, Advanced system settings and environment Variables. Then add the version of Python to the Path setting ;\C\Python27 (see video below)
Prepare your setup file, there are many templates available but the one included below was from Python School. Enter the name of the application as you wish it to be called once the build process has completed. Then select the file that you are going to build. Ensure all other related files, images etc are also stored in the folder that the Freeze will use to build the final standalone application
Load the command line (cmd) navigate to the folder that contains the python program you wish to freeze. I usually add this to the desktop so that you can easily find it. Use cd Desktop to move to the Desktop and then cd and the name of the folder that contains the Python programs and setup.py file
Run the command python setup.py build or python setup.py bdist_msi or install. Build will build an application that will run but will not require installing, it will create a stand alone application. The bdist_msi creates an installable version of the Python program that will install the program onto your computer once you open it. It will behave similar to a software install allowing you to select which directory to save / install the software to. Mac users
Further information and commands can be found at the link here
This section covers how to install and use cx_Freeze to create a stand-alone or installation version of your Python program. First download the cx_Freeze version for your computer, make sure it is the correct version for the version of Python that you code with and the 32 or 64 bit compatibility.
The easiest way the use the cx_Freeze is to run it from the command line, this requires you to add Python to the command line so that you can access an use it from the command line. Basically the simple instructions are to open the ‘advanced system settings’ (windows 7 search) Control Panel, Systems and Security settings, Systems, Advanced system settings and environment Variables. Then add the version of Python to the Path setting ;\C\Python27 (see video below)
Prepare your setup file, there are many templates available but the one included below was from Python School. Enter the name of the application as you wish it to be called once the build process has completed. Then select the file that you are going to build. Ensure all other related files, images etc are also stored in the folder that the Freeze will use to build the final standalone application
Load the command line (cmd) navigate to the folder that contains the python program you wish to freeze. I usually add this to the desktop so that you can easily find it. Use cd Desktop to move to the Desktop and then cd and the name of the folder that contains the Python programs and setup.py file
Run the command python setup.py build or python setup.py bdist_msi or install. Build will build an application that will run but will not require installing, it will create a stand alone application. The bdist_msi creates an installable version of the Python program that will install the program onto your computer once you open it. It will behave similar to a software install allowing you to select which directory to save / install the software to. Mac users
Further information and commands can be found at the link here