Skip to content

Commit

Permalink
poetry 指定python版本
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayusummer committed May 7, 2024
1 parent d2f196a commit 9d09f50
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/Language/Python/开发环境.md
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,32 @@ export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
![企业微信截图_17131654242132](http://cdn.ayusummer233.top/DailyNotes/202404151517164.png)
---
##### python 版本不对
比如这个仓库需要 `python 3.10` 以上的 python 版本, 这里虽然我全局 python 目前是 3.10, 但是 poetry 当时是 python 3.8 版本安装的, 使用了当时全局的 python 3.8 环境
![image-20240507224630840](http://cdn.ayusummer233.top/DailyNotes/202405072246932.png)
因此这里需要将 poetry 的默认 python 版本指向 python3.10
```bash
# 查看 poetry 当前使用的 python 版本(在带 pyproject.toml 的目录下执行)
poetry env info
```
![image-20240507230153035](http://cdn.ayusummer233.top/DailyNotes/202405072301117.png)
```bash
# 为 poetry 指定需要使用的 python 环境
poetry env use [python可执行程序路径]
# PS: 如果需要使用的就是当前全局的 python 的话也可以直接
poetry env use python
```
![image-20240507230346854](http://cdn.ayusummer233.top/DailyNotes/202405072303970.png)
---
Expand Down

0 comments on commit 9d09f50

Please sign in to comment.