gpt4 book ai didi

python - vscode找不到带诗和wsl的python

转载 作者:行者123 更新时间:2023-12-01 21:52:57 25 4
gpt4 key购买 nike

我想通过 WSL 在 vscode 中使用 poetry “创建”的 python interperter,但是 vscode 中没有显示正确的 python 版本。

我在 WSL 终端中运行以下命令:

$ poetry shell
Spawning shell within /home/kwint/.cache/pypoetry/virtualenvs/metal-hub-python-py3.7
$ code .

在 vscode 中发现的唯一interperter 是在/usr/ 中的。我试过手动输入 virtualenv 的路径但没有运气。这是 which python 返回的路径:/home/kwint/.cache/pypoetry/virtualenvs/metal-hub-python-py3.7/bin/python

最佳答案

您可以手动指定 "python.pythonPath"/home/kwint/.cache/pypoetry/virtualenvs/metal-hub-python-py3.7/bin/python 或尝试将 "python.venvPath" 设置为 /home/kwint/.cache/pypoetry/virtualenvs,这应该会检测到所有由 Poetry 创建的虚拟环境。

另外,请 👍 feature request to detect Poetry virtual environments如果您想获得官方支持。

关于python - vscode找不到带诗和wsl的python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58935198/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com