How to package distutils in Python learning notes

Source: Internet
Author: User

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:

 
 
  1. #!/usr/bin/env python  
  2. from distutils.core import setup  
  3. setup (# Distribution meta-data  
  4. name = "testpackage",  
  5. version = "1.0",  
  6. description = "Distutils sample distribution testpackage",  
  7. #py_modules = [''],  
  8. packages = ['TestPackage'], 

You can add more parameters.

3. Package

 
 
  1. >>> python setup.py sdist // 

Source code installation package

 
 
  1. >>> python setup.py bdist_wininst //Windows 

Use

 
 
  1. >>> 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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.