对于我的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要求?
谢谢,Mark
答案 0 :(得分:2)
pip正在安装大于1.7的numpy
版本。这是你指定的。如果您正在寻找所需版本的完全匹配,可以尝试以下方法:
install_requires=['numpy==1.7', ... ]
或者,如果您想指定特定范围,您可以这样做:
install_requires['numpy>=1.7,<1.10' ... ]