pipenv install --dev 安装开发依赖时报错 THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE

pipenv

#1

以下是主要错误,之前clone其他项目并安装开发依赖时在try again时是成功的,这次不行

95b26b726e46758b71393267aeae0bd36f8b3ade80! Will try again.
Ignoring enum34: markers 'python_version < "3.4"' don't match your environment
Ignoring ipaddress: markers 'python_version == "2.7"' don't match your environment
  ================================ 40/40 - 00:01:40
An error occurred while installing mako==1.0.7 --hash=sha256:4e02fde57bd4abb5ec400181e4c314f56ac3e49ba4fb8b0d50bba18cb27d25ae! Will try again.
Installing initially failed dependencies…
     ================================ 2/2

[pipenv.exceptions.InstallError]:   File "d:\py3.7\lib\site-packages\pipenv\core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]:   File "d:\py3.7\lib\site-packages\pipenv\core.py", line 862, in do_install_dependencies
[pipenv.exceptions.InstallError]:       _cleanup_procs(procs, False, failed_deps_queue, retry=False)
[pipenv.exceptions.InstallError]:   File "d:\py3.7\lib\site-packages\pipenv\core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting coverage==4.5.1 (from -r C:\\Users\\ASUS\\AppData\\Local\\Temp\\pipenv-6bjkcio0-requirements\\pipenv-wxs0df5t-requirement.txt (line 1))', '  Using cached https://files.pythonhosted.org/packages/25/1c/36da29f83b89d745703cbff3b3dd5b27e7143fbce252b7145b5ccf583e7b/coverage-4.5.1-cp37-cp37m-win_amd64.whl']
[pipenv.exceptions.InstallError]: ['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.', '    coverage==4.5.1 from https://files.pythonhosted.org/packages/25/1c/36da29f83b89d745703cbff3b3dd5b27e7143fbce252b7145b5ccf583e7b/coverage-4.5.1-cp37-cp37m-win_amd64.whl#sha256=f05a636b4564104120111800021a92e43397bc12a5c72fed7036be8556e0029e (from -r C:\\Users\\ASUS\\AppData\\Local\\Temp\\pipenv-6bjkcio0-requirements\\pipenv-wxs0df5t-requirement.txt (line 1)):', '        Expected sha256 03481e81d558d30d230bc12999e3edffe392d244349a90f4ef9b88425fac74ba

#2

错误原因是 Pipenv 缓存的包文件 hash 和 Pipfile.lock 里的 hash 不对应,具体原因我还不清楚。临时的解决办法是使用下面的安装命令(跳过版本锁定):

$ pipenv install coverage --skip-lock

这个帖子相关。另外,下次发帖请注意代码块排版。


#3

好的,谢谢。