我想通过 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/