默认情况下,setuptools 总是安装在 Python 中吗?

Is setuptools always installed in Python by default?

setuptools 是否总是与 Python 一起安装?

我想在 setup.py 脚本之外的运行时调用 setuptools

换句话说,我是否应该在包裹的 requirements.txtsetup.pyinstall_requires 列表中包含 setuptools


背景

我在创建新的虚拟环境(使用 Python 3.7.9)时注意到默认安装了 pipsetuptools

python -m venv venv
source ./venv/bin/activate
pip list

Package    Version
---------- -------
pip        20.1.1
setuptools 47.1.0

此处记录:Creating Virtual Environments:

venv is available by default in Python 3.3 and later, and installs pip and setuptools into created virtual environments in Python 3.4 and later.

即使是 Python 3.7.6 的原始版本(通过 pyenv 安装),默认安装的软件包也是 pipsetuptools


研究

通知 setuptools 不应包含在 setup_requires 中,但不会谈论将其包含在运行时使用的包要求中。

TL;DR

正式,否。通常,是。

setuptools 不是 python 原始代码库的一部分,因此不是 vanilla modules

python.org 安装程序或 mac homebrew 会为你安装它,但如果有人自己编译 python 或在某些 linux 发行版上安装它,他可能不会得到它,需要 install it by himself.