Python 使用Poetry安装sqlalchemy报错AttributeError解决方法

本文主要介绍Python中,执行 pip install sqlalchemy没问题,但执行poetry安装报错: AttributeError 'EmptyConstraint' object has no attribute 'allows'的解决方法。

报错信息:

→   backend poetry add sqlalchemy
Using version ^1.4.23 for SQLAlchemy
Updating dependencies
Resolving dependencies... (0.1s)
  AttributeError
  'EmptyConstraint' object has no attribute 'allows'
  at ~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/version/markers.py:291 in validate
      287│
      288│         if self._name not in environment:
      289│             return True
      290│
    → 291│         return self._constraint.allows(self._parser(environment[self._name]))
      292│
      293│     def without_extras(self):  # type: () -> MarkerTypes
      294│         return self.exclude("extra")
      295│
→   backend

解决方法

尝试执行下面命令:

poetry self update
poetry update

或者

pip install -U poetry

或者

poetry add sqlalchemy=1.4.22

推荐阅读
cjavapy编程之路首页