诗加 <package> returns AttributeError
Poetry add <package> returns AttributeError
我正在尝试使用诗歌创建一个 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):
我尝试过的每个包都会出现这种情况(pandas、geopandas、numpy、shapely)。我不太明白问题是什么,我在 GitHub 或这里也没有发现任何类似的问题。
问题:导致此错误的原因是什么,我该如何解决?
我用Ubuntu18.04,Python3.6.9
最后,对我有用的是按照描述重新安装诗歌in the docs:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
而不是
python3 -m pip install poetry
我正在尝试使用诗歌创建一个 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):
我尝试过的每个包都会出现这种情况(pandas、geopandas、numpy、shapely)。我不太明白问题是什么,我在 GitHub 或这里也没有发现任何类似的问题。
问题:导致此错误的原因是什么,我该如何解决?
我用Ubuntu18.04,Python3.6.9
最后,对我有用的是按照描述重新安装诗歌in the docs:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
而不是
python3 -m pip install poetry