VS Code中的Anaconda配置和调试python

问题描述

我在 anaconda 中使用 VS Code,它是 python 版本。是 3.6.x。我在最后一天安装了 python 3.9。在此之后,我的蟒蛇稳定性受到干扰。当我启动 VS Code 时,它​​会自动运行“conda activate”命令。但现在不是了。 git 现在也无法从终端识别。我解决了它 ctrl+p 然后选择 shell -> git bash。

但现在我有一个问题。我正在用 F5 调试,但现在它说

cmd /C "C:\Users\Fordev\anaconda3\python.exe c:\Users\Fordev\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\lib\python\debugpy\launcher 58000 -- c:\Users\Fordev\Desktop\tkczmkmsi\.vscode\settings.json "
'cmd' is not recognized as an internal or external command,operable program or batch file.

此后它等待然后说“timed out waiting for launcher to connect

现在我从 env 中删除了我的 python 路径。变量和系统变量。我想现在我的配置真的很复杂,因为我尝试了我看到的所有解决方案。
目前,我的环境变量:
用户变量路径 = C:\Users\Fordev\anaconda3\;C:\Users\Fordev\anaconda3\Scripts 系统变量路径 = C:\Users\Mp\AppData\Local\Programs\Python\python39\;C:\Users\Fordev\anaconda3\;C:\Users\Fordev\anaconda3\Scripts
我的启动器 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: Geçerli Dosya","type": "python","request": "launch","program": "${file}","console": "integratedTerminal"
        }
    ]
}

我的设置 Json:

{
    "python.pythonPath": "C:\\Users\\Fordev\\anaconda3\\python.exe"
}

如何在 Anaconda 中稳定配置 VS Code?我可以运行我的 python 代码,但我无法调试它。而且为了使用 github,我每次都必须将我的 shell 更改为 git bash,而我不想要那样。
谁能告诉我有什么问题吗?

解决方法

根据您提供的信息,

"c:\Users\Fordev\Desktop\tkczmkmsi\.vscode\settings.json"

表示VS Code当前正在调试的文件是“settings.json”。

请尝试重新加载 VS Code,然后打开 python 文件并单击“F5”以调试 python 文件。

enter image description here