This article describes how to use distutils to package practical application solutions in Python learning notes. If you have a detailed introduction to the Practical Application Operation solution packaged by distutils In the Python study notes, the following is an introduction to the article. I hope you will gain some benefits.
Use distutils to package Python learning notes and use distutils to install the python modules or packages written into the python directory.
Steps:
1. Prepare the modules and packages to be installed.
2. Compile setup. py, for example:
- #!/usr/bin/env python
- from distutils.core import setup
- setup (# Distribution meta-data
- name = "testpackage",
- version = "1.0",
- description = "Distutils sample distribution testpackage",
- #py_modules = [''],
- packages = ['TestPackage'],
You can add more parameters.
3. Package
- >>> python setup.py sdist //
Source code installation package
- >>> python setup.py bdist_wininst //Windows
Use
- >>> python setup.py bdist_rpm //Linux
Use
4. Installation
The installation of the source package is to decompress the source package and run setup. py install; while the installation package for Windows and Linux runs the installation file directly;