简体   繁体   中英

vscode can't find python with poetry and wsl

I want to use a python interperter "created" by poetry in vscode trough WSL, but the right python version doesn't show up in vscode.

I run the following commmands in a WSL terminal:

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

the only interperters found in vscode are the ones in /usr/ . I have tried manually inputting the path to the virtualenv but no luck. This is the path which python returns: /home/kwint/.cache/pypoetry/virtualenvs/metal-hub-python-py3.7/bin/python

You can either manually specify "python.pythonPath" to /home/kwint/.cache/pypoetry/virtualenvs/metal-hub-python-py3.7/bin/python or try setting "python.venvPath" to /home/kwint/.cache/pypoetry/virtualenvs and that should detect all virtual environments created by Poetry.

Also, please the feature request to detect Poetry virtual environments if you would like to see official support.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM