Python distutils
- October 5th, 2009
- Posted in Python
- Write comment
A guide to creating a simplistic .exe python package installer:
- Create a setup.py file in the directory above your package directory:
MyPythonPackage setup.py
- Copy the following in setup.py:
from distutils.core import setup import setuptools import sys setup(name='MyAmazingLibrary', version='0.1', description='My Amazing Library', author='My Name', url='http://code.google.com/p/MyAmazingLibrary/', packages=setuptools.find_packages('.'), package_dir = {'':'.'}, ) - Open a command prompt in the directory containing the setup.py and execute
python setup.py bdist_wininst
- Observe how the installer appears in the newly created
distdirectory.
Additional Notes
- To specify that the installer is only for a specific Python install use the –target-version option with setup.py, eg:
python setup.py bdist_wininst --target-version=2.5
- Swap bdist_wininst to bdist_msi to create a Windows Installer for your python package.
No comments yet.