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/
您通常不会手动创建源存档和轮子,而是使用
setuptools
和 wheel
为你这样做。现在很多包都是轮子。使用 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/