为什么pip不符合最小依赖性?

2024-04-25 20:47:27 发布

您现在位置:Python中文网/ 问答频道 /正文

对于我的Python包,我有一个设置.py我指定要求的文件:

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

当我使用pip安装时,它很好地识别出我已经指定了这些需求,然后继续更新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要求?你知道吗

谢谢,马克


Tags: install文件thepy版本numpyprojectmatplotlib
1条回答
网友
1楼 · 发布于 2024-04-25 20:47:27

pip正在安装大于1.7的numpy版本。这就是你说的。如果要查找与所需版本完全匹配的版本,可以尝试以下操作:

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

或者,如果要指定特定范围,可以执行以下操作:

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

相关问题 更多 >