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 use distutils to package and install in Python

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to use distutils packaging and installation in Python, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Using distutils, you can install written python modules or packages into the python directory. Step: prepare the modules and packages to install, and 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'])

You can add more parameters. If you want to add some data files or documents, you can modify the parameters as follows:

Packages = ['TestPackage',' TestPackage.doc'], package_data = {'TestPackage.doc': [' doc*.txt','* .ico']}

Represents all txt files at the beginning of doc and all ico files added to the doc directory. Note: when generating the source code installation package, create a MANIFEST.in file in the directory where setup.py is located, and the content is the included path, such as:

Include TestPackage\ doc\ doc*.txt include TestPackage\ doc\ * .ico on how to use distutils packaging installation in Python to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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