首页 > 解决方案 > “诗歌安装”命令失败;*.whl 文件未找到

问题描述

我正在通过 Poetry 管理我的 Python 项目中的依赖项。

现在我想在与我的开发机器不同的机器上运行这个项目。要安装依赖项,我只需从根目录运行此命令:

$ poetry install

但随后会引发以下错误:

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 70 installs, 0 updates, 0 removals

  • Installing colorama (0.4.4)
  • Installing tzdata (2021.1)

  ValueError

  File \C:\Users\tteguayco\AppData\Local\pypoetry\Cache\artifacts\9e\b3\11\7d87ac44fdb2d557301f1f4086a37c080d1482a98751abe7cdbabbad26\colorama-0.4.4-py2.py3-none-any.whl does not exist

  at ~\AppData\Local\Programs\Python\Python39\lib\site-packages\poetry\core\packages\file_dependency.py:40 in __init__
       36│             except FileNotFoundError:
       37│                 raise ValueError("Directory {} does not exist".format(self._path))
       38│
       39│         if not self._full_path.exists():
    →  40│             raise ValueError("File {} does not exist".format(self._path))
       41│
       42│         if self._full_path.is_dir():
       43│             raise ValueError("{} is a directory, expected a file".format(self._path))
       44│


  ValueError

  File \C:\Users\tteguayco\AppData\Local\pypoetry\Cache\artifacts\45\2d\cb\6443e36999e7ab3926d5385dfac9ee9ea2a62f8111ff71abb6aff70674\tzdata-2021.1-py2.py3-none-any.whl does not exist

  at ~\AppData\Local\Programs\Python\Python39\lib\site-packages\poetry\core\packages\file_dependency.py:40 in __init__
       36│             except FileNotFoundError:
       37│                 raise ValueError("Directory {} does not exist".format(self._path))
       38│
       39│         if not self._full_path.exists():
    →  40│             raise ValueError("File {} does not exist".format(self._path))
       41│
       42│         if self._full_path.is_dir():
       43│             raise ValueError("{} is a directory, expected a file".format(self._path))
       44│

最好知道这些 *.whl 是什么以及 Poetry 如何使用它们。

标签: pythonpython-poetry

解决方案


具体来说,我发现删除AppData\Local\pypoetry\Cache\artifacts文件夹(我在 Windows 10 上)对我有用。其他项目的 virtualenvs 可能在其中,AppData\Local\pypoetry\Cache\virtualenvs因此您可能不想完全删除根缓存文件夹AppData\Local\pypoetry\Cache


推荐阅读