简体   繁体   中英

VScode + pipenv + pyenv in WSL : debugger not working with Python only for non-system Python version

I am experiencing a problem with VScode debugger after I try to create a Pipenv environment with a specific python version that is not my original system version (3.7.3)

pipenv install --python <version>

I can tell anyway that the environment is activated correctly and I can run (in and out of Vscode) any Python script and the Python version is consistent (tested with pipenv run python --version )

This is the error I encounter each time I have a pipenv environment with anything different than my original system 3.7.3 python:

在此处输入图像描述

But if I create a pipenv environment with my original python version 3.7.3 then all works fine with the debugger:

在此处输入图像描述

I tried many things but I am not sure if this is an issue with WSL or pipenv or pyenv with VScode, I suspect a bug but I am not too sure

I have pipenv : 2022.6.7 pyenv : 2.3.1-20-g572a8bcf Vscode : 1.68.1 Python versions 3.7.3 -> system 3.8.13 3.9.13 3.10.4 -> Global

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        }
    ]
}

Take a closer look at the upper left corner of your first picture.

Vscode prompted you to create a "launch.json". I don't think you created a "launch.json" in the workspace during your first debugging process. Please follow the prompts.

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