什么是 Python 蛋?
问题描述
我是 Python 新手,我只是想了解它的包是如何工作的.大概 eggs
是某种包装机制,但什么是它们所扮演角色的快速概述,可能是关于它们为什么有用以及如何创建它们的一些信息?
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
文件的概念相同,它是一个.zip
文件,其中一些元数据文件重命名为.egg
,用于分发代码作为包.
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的内部结构
Python 蛋"是一个逻辑结构,体现了一个Python 项目的特定版本,包括其代码、资源、和元数据.有多种格式可用于物理编码一个 Python 蛋,其他的可以开发.然而,Python 鸡蛋的一个关键原则是它们应该是可发现的,并且可导入.也就是说,Python 应用程序应该可以轻松有效地找出系统上存在哪些鸡蛋,以及以确保所需的鸡蛋内容是可导入的.
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
格式非常适合分发和简单卸载或升级代码,因为该项目本质上是自包含在单个目录或文件中,不与任何其他项目的代码或资源.这也使得拥有同时安装一个项目的多个版本,这样各个程序可以选择他们希望使用的版本.
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.
相关文章