How to Package Python Scripts
Python is an interpreted, object-oriented programming language that requires installation of the Python interpreter prior to executing Python programs (scripts). However, if you wish to distribute and run Python programs on platforms that do not have the Python interpreter, Python includes a tool for packaging Python scripts. Use the "freeze.py" tool included with the Python interpreter to package programs for distribution to Linux and Unix platforms that may not have Python installed.
Things You'll Need
- The Python programming packages compiled from source code and installed on a Linux or Unix computer
- Path to the Python program script you wish to package
Instructions
-
-
1
Open a command line terminal on a Linux or Unix computer that have the Python programming packages compiled and installed. Type "find / -name freeze.py" and press the "Enter" key. Note the path to the "freeze.py" file in the command line output.
-
2
Enter "cd /path_to_file/" at the command prompt, replacing "/path_to_file/" with the exact path where the Python program script you wish to package is located. Press the "Enter" key.
-
-
3
Type "python /path_to_freeze/freeze.py program.py" at the command line, replacing "path_to_freeze" with the exact path to the freeze.py file and replacing the "program.py" with the name of the Python program script you wish to package. Press the "Enter" key.
-
4
Enter "make" at the command prompt once the output of the previous command has completed and tap the "Enter" key.
-
1
References
Resources
- Photo Credit Stockbyte/Stockbyte/Getty Images