Get the App
SLTechnology News&Howtos  ›  Development  › 

How to package with distutils in Python

Shulou Source: shulou.com Published: 2022-06-02 23:36:36 09月14日 Update

This article is to share with you about how to use distutils packaging in Python, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Packaging with distutils in Python

Using distutils, you can install written python modules or packages into the python directory.

Steps:

1. Prepare the modules and packages to be installed

two。 Write setup.py, such as:

#! / 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'])

More parameters can be added.

3. Packing

> > python setup.py sdist / /

Source code installation package

> > python setup.py bdist_wininst / / Windows

Use

> > python setup.py bdist_rpm / / Linux

4. Installation

The installation of the source code package is to extract the source code package and run setup.py install;, while the Windows and Linux installation packages run the installation files directly.

The above is how to use distutils packaging in Python. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: More source code modules knowledge articles runs utility parameters that is work meetings documents articles steps directories look knowledge points industry details information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MySQL Shulou Information MariaDB vpn