自包含的高可移植性Python发行版

Hacker News Top 工具

摘要

该项目提供自包含、高可移植性的Python发行版,运行时依赖极少,适用于将Python嵌入到更大的二进制文件中或在多样化的系统上运行。

暂无内容
查看原文
查看缓存全文

缓存时间: 2026/07/27 19:46

# Python 独立构建 —— python-build-standalone 文档 来源:https://gregoryszorc.com/docs/python-build-standalone/main/ 本项目生成自包含、高度可移植的 Python 发行版。这些 Python 发行版包含一个完整可用、功能齐全的 Python 安装:Python 标准库中的大多数扩展模块都已包含,其库依赖要么随发行版一并分发,要么以静态链接方式提供。 这些 Python 发行版在构建时尽可能减少运行时依赖项。这包括限制可使用的 CPU 指令集以及运行时所需的共享库集合。目标是使生成的发行版能在目标架构的任何系统上正常工作。 部分发行版随附构建产物(目标文件、库等)以及描述发行版及其构建方式的丰富元数据。下游重新打包者可以重新组合这些构建产物,推导出定制化的 Python 发行版,可能去掉某些特性(如 SQLite 和 OpenSSL)。这对于将 Python 嵌入到更大的二进制文件中非常有用。请参见 [PyOxidizer](https://github.com/indygreg/PyOxidizer) 姊妹项目以了解此类下游重新打包工具。 许多本发行版的用户可能更适合使用 [PyOxy](https://pyoxidizer.readthedocs.io/en/latest/pyoxy.html) 姊妹项目。PyOxy 以这些 Python 发行版为基础,添加了一些 Rust 代码以增强 Python 解释器的功能。官方的 PyOxy 发布二进制文件是单个可执行文件,提供功能齐全的 Python 解释器。 内容: - [运行发行版](https://gregoryszorc.com/docs/python-build-standalone/main/running.html) - [获取发行版](https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions) - [解压发行版](https://gregoryszorc.com/docs/python-build-standalone/main/running.html#extracting-distributions) - [运行时要求](https://gregoryszorc.com/docs/python-build-standalone/main/running.html#runtime-requirements) - [附加 Python 软件](https://gregoryszorc.com/docs/python-build-standalone/main/running.html#extra-python-software) - [许可](https://gregoryszorc.com/docs/python-build-standalone/main/running.html#licensing) - [重新利用构建产物](https://gregoryszorc.com/docs/python-build-standalone/main/running.html#reconsuming-build-artifacts) - [构建](https://gregoryszorc.com/docs/python-build-standalone/main/building.html) - [Linux](https://gregoryszorc.com/docs/python-build-standalone/main/building.html#linux) - [macOS](https://gregoryszorc.com/docs/python-build-standalone/main/building.html#macos) - [Windows](https://gregoryszorc.com/docs/python-build-standalone/main/building.html#windows) - [行为特点](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html) - [Python REPL 中特殊键不生效](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html#if-special-keys-do-not-work-in-the-python-repl) - [UNIX 上无 tix](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html#no-tix-on-unix) - [Windows 上无 `pip.exe`](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html#no-pip-exe-on-windows) - [macOS 上链接静态库](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html#linking-static-library-on-macos) - [Linux 上使用 `libedit`](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html#use-of-libedit-on-linux) - [引用构建时路径](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html#references-to-build-time-paths) - [已解决的特点](https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html#former-quirks) - [技术说明](https://gregoryszorc.com/docs/python-build-standalone/main/technotes.html) - [工作原理](https://gregoryszorc.com/docs/python-build-standalone/main/technotes.html#how-it-works) - [Setup.local 的 hack 处理](https://gregoryszorc.com/docs/python-build-standalone/main/technotes.html#setup-local-hackery) - [依赖项说明](https://gregoryszorc.com/docs/python-build-standalone/main/technotes.html#dependency-notes) - [升级 CPython](https://gregoryszorc.com/docs/python-build-standalone/main/technotes.html#upgrading-cpython) - [发行版归档](https://gregoryszorc.com/docs/python-build-standalone/main/distributions.html) - [完整归档](https://gregoryszorc.com/docs/python-build-standalone/main/distributions.html#full-archive) - [仅安装归档](https://gregoryszorc.com/docs/python-build-standalone/main/distributions.html#install-only-archive) - [项目状态](https://gregoryszorc.com/docs/python-build-standalone/main/status.html) - [目标说明](https://gregoryszorc.com/docs/python-build-standalone/main/status.html#target-notes) - [测试失败](https://gregoryszorc.com/docs/python-build-standalone/main/status.html#test-failures) - [测试跳过](https://gregoryszorc.com/docs/python-build-standalone/main/status.html#test-skips) ## 索引和表格¶ (https://gregoryszorc.com/docs/python-build-standalone/main/#indices-and-tables) - [索引](https://gregoryszorc.com/docs/python-build-standalone/main/genindex.html) - [搜索页面](https://gregoryszorc.com/docs/python-build-standalone/main/search.html)

相似文章

构建我梦寐以求的部署工具

Lobsters Hottest

作者详细介绍了一款名为'Deptool'的自定义Python部署与配置管理工具的开发过程。该工具旨在比Ansible等现有方案更快、更可预测,源于对数字主权和更优工具的追求。

用于构建Claude Code hooks的Python工具包

Hacker News Top

一个减少构建Claude Code hooks样板代码的Python工具包,提供类型安全的事件处理器,用于工具使用前/后、提示提交和会话开始钩子。