python环境
- Python 3.11 安装目录
D:\software\Python311
安装 poetry
- 设置环境变量
D:\software\Python311\Scripts\
D:\software\Python311\
C:\Users\Administrator\.local\bin
- 设置 pip 国内镜像源
python -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
- 升级 pip
python -m pip install pip --upgrade
- 安装或升级 pipx
python -m pip install pipx --upgrade
- 在 Python 3.11 下用 pipx 安装 Poetry
python -m pipx install poetry --force -i https://mirrors.aliyun.com/pypi/simple/
- 查看安装情况
> where poetry
> poetry --version
- 修改 potry 缓存目录
poetry config cache-dir D:\pypoetry
- 设置将虚拟环境目录放在项目内
poetry config virtualenvs.in-project true
注:如果安装依赖包有以下报错:
_WheelFileValidationError
version.py is not mentioned in RECORD
In {self._zipfile.filename}, hash / size of {item.filename} didn't match RECORD
可以 poetry shell 进入虚拟环境后用 pip 安装报错的包