新聞中心
Setuptools是python Distutils的加強(qiáng)版,可以讓程序員更方便的創(chuàng)建和發(fā)布 Python 包,特別是那些對(duì)其它包具有依賴性的狀況。用setuptools構(gòu)建和發(fā)布的包與用Distutils發(fā)布的包是類(lèi)似的。

創(chuàng)新互聯(lián)專(zhuān)注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、仁化網(wǎng)絡(luò)推廣、成都微信小程序、仁化網(wǎng)絡(luò)營(yíng)銷(xiāo)、仁化企業(yè)策劃、仁化品牌公關(guān)、搜索引擎seo、人物專(zhuān)訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供仁化建站搭建服務(wù),24小時(shí)服務(wù)熱線:18982081108,官方網(wǎng)址:www.cdcxhl.com
包的使用者無(wú)需安裝setuptools就可以使用該包。如果用戶是從源碼包開(kāi)始構(gòu)建,并且沒(méi)有安裝過(guò)setuptools的話,則只要在你的setup腳本中包含一個(gè)bootstrap模塊(ez_setup),用戶構(gòu)建時(shí)就會(huì)自動(dòng)下載并安裝setuptools了。
一:基本用例
下面是一個(gè)使用setuptools的簡(jiǎn)單例子:
from setuptools import setup, find_packages setup( name = "HelloWorld", version = "0.1", packages = find_packages(), )
上面就是一個(gè)最簡(jiǎn)單的setup腳本,使用該腳本,就可以產(chǎn)生eggs,上傳PyPI,自動(dòng)包含setup.py所在目錄中的所有包等。
當(dāng)然,上面的腳本過(guò)于簡(jiǎn)單,下面是一個(gè)稍微復(fù)雜的例子:
from setuptools import setup, find_packages
setup(
name = "HelloWorld",
version = "0.1",
packages = find_packages(),
scripts = ['say_hello.py'],
# Project uses reStructuredText, so ensure that the docutils get
# installed or upgraded on the target machine
install_requires = ['docutils>=0.3'],
package_data = {
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
'hello': ['*.msg'],
},
# metadata for upload to PyPI
author = "Me",
author_email = "[email protected]",
description = "This is an Example Package",
license = "PSF",
keywords = "hello world example examples",
url = "http://example.com/HelloWorld/", # project home page, if any
# could also include long_description, download_url, classifiers, etc.
)
網(wǎng)站題目:創(chuàng)新互聯(lián)Python教程:python中setuptools是什么
文章路徑:http://fisionsoft.com.cn/article/dpgiicc.html


咨詢
建站咨詢
