📅 2011-Jun-02 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ pyinstaller, python, windows ⬩ 📚 Archive
Converting a Python script into a EXE file is a convenient way to share it among other computers or users who do not have Python installed. PyInstaller makes this process really easy! Here is how:
Download and unzip PyInstaller. It is not a Python library, so it does not need to be installed into Python. Let us assume the unzipped files are placed in C:\PyInstaller
Open a Command Prompt in the PyInstaller directory and configure it using: python Configure.py
Open a Command Prompt in the directory containing your Python script (say Foo.py
). I assume you want to convert it into a single EXE file. Create a spec file for Foo.py
by using: python C:\PyInstaller\Makespec.py --onefile Foo.py
This generates a Foo.spec
file.
Build the EXE file for Foo.py
by using: python C:\PyInstaller\Build.py Foo.spec
Your Foo.exe
file is now ready for distribution and can be found in the dist
directory! 😊
Tried with: PyInstaller 1.5, Python 2.7 and Windows 7