诗歌添加<package>返回AttributeError

2024-04-20 12:44:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用诗歌创建一个Python包。我无法复制中描述的步骤 documentation。当我试图增加依赖性时,例如

poetry add pendulum

我明白了

jan@jan-XPS-13-9380:~/Documents/Simosol/tmp/poetry-test$ poetry add pendulum
Using version ^2.1.2 for pendulum

Updating dependencies
Resolving dependencies... (1.0s)

  AttributeError

  __enter__

  at ~/.local/lib/python3.6/site-packages/poetry/utils/helpers.py:98 in download_file
       94│     url, dest, session=None, chunk_size=1024
       95│ ):  # type: (str, str, Optional[requests.Session], int) -> None
       96│     get = requests.get if not session else session.get
       97│ 
    →  98│     with get(url, stream=True) as response:
       99│         response.raise_for_status()
      100│ 
      101│         with open(dest, "wb") as f:
      102│             for chunk in response.iter_content(chunk_size=chunk_size):

我试过的每一个包(熊猫包、geopandas包、numpy包、shapely包)都会出现这种情况。我不太明白问题出在哪里,在GitHub或此处也没有发现任何类似的问题

问题:导致此错误的原因是什么?如何修复

我使用Ubuntu 18.04、Python 3.6.9


Tags: innoneaddurlforsizegetpoetry
1条回答
网友
1楼 · 发布于 2024-04-20 12:44:54

最后,对我起作用的是重新安装诗歌,如所述in the docs

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

而不是

python3 -m pip install poetry

相关问题 更多 >