問題描述
我是 Python 新手,我只是想了解它的包是如何工作的.大概 eggs
是某種包裝機(jī)制,但什么是它們所扮演角色的快速概述,可能是關(guān)于它們?yōu)槭裁从杏靡约叭绾蝿?chuàng)建它們的一些信息?
I'm new to Python and I'm just trying to understand how its packages work. Presumably eggs
are some sort of packaging mechanism, but what would be a quick overview of what role they play and may be some information on why they're useful and how to create them?
推薦答案
注意:雞蛋包裝已被車輪包裝取代.
與Java中的.jar
文件的概念相同,它是一個(gè).zip
文件,其中一些元數(shù)據(jù)文件重命名為.egg
,用于分發(fā)代碼作為包.
Same concept as a .jar
file in Java, it is a .zip
file with some metadata files renamed .egg
, for distributing code as bundles.
具體來說:Python Eggs的內(nèi)部結(jié)構(gòu)
Python 蛋"是一個(gè)邏輯結(jié)構(gòu),體現(xiàn)了一個(gè)Python 項(xiàng)目的特定版本,包括其代碼、資源、和元數(shù)據(jù).有多種格式可用于物理編碼一個(gè) Python 蛋,其他的可以開發(fā).然而,Python 雞蛋的一個(gè)關(guān)鍵原則是它們應(yīng)該是可發(fā)現(xiàn)的,并且可導(dǎo)入.也就是說,Python 應(yīng)用程序應(yīng)該可以輕松有效地找出系統(tǒng)上存在哪些雞蛋,以及以確保所需的雞蛋內(nèi)容是可導(dǎo)入的.
A "Python egg" is a logical structure embodying the release of a specific version of a Python project, comprising its code, resources, and metadata. There are multiple formats that can be used to physically encode a Python egg, and others can be developed. However, a key principle of Python eggs is that they should be discoverable and importable. That is, it should be possible for a Python application to easily and efficiently find out what eggs are present on a system, and to ensure that the desired eggs' contents are importable.
.egg
格式非常適合分發(fā)和簡(jiǎn)單卸載或升級(jí)代碼,因?yàn)樵擁?xiàng)目本質(zhì)上是自包含在單個(gè)目錄或文件中,不與任何其他項(xiàng)目的代碼或資源.這也使得擁有同時(shí)安裝一個(gè)項(xiàng)目的多個(gè)版本,這樣各個(gè)程序可以選擇他們希望使用的版本.
The .egg
format is well-suited to distribution and the easy
uninstallation or upgrades of code, since the project is essentially
self-contained within a single directory or file, unmingled with any
other projects' code or resources. It also makes it possible to have
multiple versions of a project simultaneously installed, such that
individual programs can select the versions they wish to use.
這篇關(guān)于什么是 Python 蛋?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!