python - pip install 实际上是做什么的?

标签 python pip package pypi pypiserver

super 新手问题在这里..

pip install 实际上是做什么的?

假设 pypi 包是一个压缩包......

它只是下载 tar.gz,解压并运行 setup.py 吗?

它是否将下载的包添加到 site_packages 文件夹?

我想使用 pypiserver 创建一个 pip 可安装的 pkg,这样我的同事就可以轻松下载我的 pkg,但我有 pip 不确定在实际的 .py 脚本之外到底要包含什么。

任何指导将不胜感激

最佳答案

The tar.gz file is a source archive whereas the .whl file is a built distribution. Newer pip versions preferentially install built distributions, but will fall back to source archives if needed. You should always upload a source archive and provide built archives for the platforms your project is compatible with. In this case, our example package is compatible with Python on any platform so only one built distribution is needed.



见:https://packaging.python.org/tutorials/packaging-projects/

您通常不会手动创建源存档和轮子,而是使用 setuptoolswheel为你这样做。

现在很多包都是轮子。使用 pip 安装这些轮子时,pip 将:

[...] unpack the archive in your current site packages directory and install any console scripts contained in the wheel.



见:https://wheel.readthedocs.io/en/stable/user_guide.html#installing-wheels

关于python - pip install 实际上是做什么的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57147721/

相关文章:

java - 如何恢复 Oracle JDK 更新?

node.js - 如何从另一个 Github 项目添加依赖项?

python 国际象棋 - AttributeError : module 'chess' has no attribute 'pgn'

python - Spyne 故障 - HTTP 返回代码

Python -- time.sleep() 按代码持续时间偏移

python - Pip 使用系统 python osx

python - 使 python 模块可用作 cli 工具的最简单方法

python - 使用python获取该函数内的当前函数名称

python - 如何在模块中包含 *.py 以外的文件?

java - eclipse 错误地将包解释为 "resources"或源文件夹