本文主要介绍Python中,执行poetry install安装依赖时,报错:tzdata-2021.1-py2.py3-none-any.whl does not exist的解决方法。

报错信息:

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│

解决方法:

可以尝试删除AppData\Local\pypoetry\Cache\artifacts文件夹。

或者

通过poetry导出依赖到requirements.txt,然后通过pip安装依赖

poetry export -f requirements.txt --output requirements.txt --without-hashes
pip install -r requirements.txt

推荐文档

相关文档

大家感兴趣的内容

随机列表