gpt4 book ai didi

python - 为什么 pip 不遵守最小依赖关系?

转载 作者:行者123 更新时间:2023-12-01 03:54:48 26 4
gpt4 key购买 nike

对于我的 Python 包,我有一个 setup.py 文件,我在其中指定要求:

install_requires=['numpy>=1.7', 'matplotlib>=1.3'],

当我使用 pip install 时,它很好地识别出我已经指定了这些要求,然后在我的 numpy 版本高于所需版本时继续更新 numpy。

Collecting numpy>=1.7 (from flopy)
Downloading numpy-1.11.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.9MB)
Fund existing installation: numpy 1.10.1
DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling numpy-1.10.1:
Successfully uninstalled numpy-1.10.1

我与几个人交谈过,他们都报告了相同的行为。为什么是这样?如何正确指定 numpy 要求?

谢谢,马克

最佳答案

pip 正在安装高于 1.7 的 numpy 版本。这是你指定的。如果您正在寻找与您想要的版本完全匹配的版本,您可以尝试以下操作:

install_requires=['numpy==1.7', ... ]

或者,如果您想指定特定范围,您可以这样做:

install_requires['numpy>=1.7,<1.10' ... ]

关于python - 为什么 pip 不遵守最小依赖关系?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37656690/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com