首页 > 解决方案 > 我无法在我的虚拟环境中安装 Django

问题描述

我想在我的虚拟环境中安装 Django(它完全可以工作),但是遇到了很多错误。有谁知道该怎么做?

我刚刚在 PowerShell 中输入了这个:

 pipenv install django

得到了这个:

Error:  An error occurred while installing django!
Error text: Collecting django
  Using cached Django-3.1.7-py3-none-any.whl (7.8 MB)

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM Pipfile.lock!. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    django from https://files.pythonhosted.org/packages/b8/6f/9a4415cc4fe9228e26ea53cf2005961799b2abb8da0411e519fdb74754fa/Django-3.1.7-py3-none-any.whl#sha256=baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8 (from -r c:\users\vojtěch\appdata\local\temp\pipenv-e9otm_0m-requirements\pipenv-sj4h6g3_-requirement.txt (line 1)):
        Expected sha256 baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8
             Got        764ad5e659cd3a7740b314806b39c67501c6136a21d23652515df3bfb4023d76

标签: pythondjangopipvirtualenvpipenv

解决方案


看起来您的原始下载可能已失败,并且 pip 正在使用缓存下载而不是获取新下载。再试pipenv lock --clear一次pipenv install django


推荐阅读