【已解决】Hashes don’t match the requirement.txt 解决过程
我想安装opencv-python,一直报错这个:“ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
opencv-python from https://files.pythonhosted.org/packages/1a/12/a94f6e1aa2d03a483c641da4e8ec20d511a3ece2a087bb3232192e6c6987/opencv_python-4.7.0.72-cp37-abi3-macosx_10_16_x86_64.whl:
Expected sha256 d4f8880440c433a0025d78804dda6901d1e8e541a561dda66892d90290aef881
Got ac4c45c4d4597b78dbd235bb85332fcd181ca90022ba8409d09054b96862215a”
应该是Opencv-python包的版本Hash与pip中的requirement Hash不匹配了。
尝试过但失败的方法:
- pip install opencv-python
- pip install opencv-python --no-cache-dir
- pip install --upgrade opencv-python
- pip cache purge
最终成功
pip3 install opencv-python --no-cache-dir
分析,要使用pip3, 且加上–no-cache-dir。当使用docker容器时,我们会加入 --no-cache-dir 去让pip不要把要安装的包下载到本地。