使用pip install -r requirements.txt 命令批量安装模块时,报错:
Double requirement given: numpy==1.12.1 from https://files.pythonhosted.org/packages/d8/f9/97aa0903ae39ed4ab6df1c9c22902f3c71f4330a54cf5a81b2bea585544d/numpy-1.12.1-cp27-cp27m-manylinux1_x86_64.whl#sha256=ca917155b35b3bcc68ef1ad82570a29414f5088495ea8f68c65b071c50e64340 (already in numpy==1.9.3 from https://files.pythonhosted.org/packages/f8/63/eca0990ba29244de118489d82ab7511d72cc02bf8ae81ca1aa2a4774d087/numpy-1.9.3-cp27-cp27m-manylinux1_x86_64.whl#sha256=da1563ede37a54c2bd5ab3cb3def94c386f4c7482242cdb7921c22756bbeb461, name='numpy')
从Stack Overflow上查到的解决办法, 出现这个问题是因为当前安装的模块与现有的环境中的模块冲突,加上这个参数后,可以禁止构建隔离,参考 https://pip.pypa.io/en/stable/reference/pip/
解决办法:
pip install -r requirements.txt --no-build-isolation
把当前环境依赖的模块,导出到一个文件的命令:pip freeze > requirements.txt