Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to package with distutils in Python

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report