windows10系统,python3.9版本,安装poetry:
踩过了大部分的坑,以下是我最终成功的一套方法:
一、离线安装poetry:
1、访问https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py,将网页中的代码存到某文件夹(以下用A文件夹代替),命名为install.py
2、在 https://github.com/python-poetry/poetry/releases网站的"Assets"模块下载对应平台的 realse 版本,例如我下载的是poetry-1.1.13-win32.tar.gz(实际上我是64位,但也能用)
3、将下载的压缩包存到与install.py文件同级的A文件夹下,不要解压
4、在A文件夹进入cmd,运行python install.py --file poetry-1.1.13-win32.tar.gz
5、配置环境变量
二、在项目文件夹下运行poetry install时报错:
The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.
1、输入以下命令可以解决:
poetry update foo
2、运行以上命令后出现以下状态:
Updating dependencies
Resolving dependencies...
三、解决“Resolving dependencies...”悬挂时间过长的问题
1、将安装源指定为阿里云,在项目路径下的pyproject.toml中添加如下配置:
[[tool.poetry.source]]
name = "aliyun"
url = "https://mirrors.aliyun.com/pypi/simple/"
2、“Resolving dependencies...”仍在悬挂,后台挂着千万别关,耐心等待,先着手其他事情。
趁你不注意,他就安装好了。
以上是今日遇到疑难杂症的总结,欢迎指摘建议。
【以上参考来源于:
一、(3条消息) Python Poetry安装慢的解决办法_照物华的博客-CSDN博客_poetry 安装
二、如何在不升级依赖项的情况下更新Poetry的锁文件? - 问答 - Python中文网 (cnpython.com)】