我是python和anaconda的新手,我安装并设置了包括环境变量在内的所有内容。 然后我打开vs代码并输入
print("hello world")
并尝试调试。 我没有得到任何输出,并且在调试器上出现了几个超时。 这是运行调试器后在终端上显示的内容:
(基本)C:\ Users \ Arun> cd e:\ pythontutorials && cmd / C“设置” PYTHONIOENCODING = UTF-8“ &&设置” PYTHONUNBUFFERED = 1“ && E:\ Python \ pythonw.exe c:\ Users \ Arun.vscode \ extensions \ ms-python.python-2018.11.0 \ pythonFiles \ experimental \ ptvsd_launcher.py --default --client --host localhost --port 62293 e:\ pythontutorials \ firstprogram.py“ >
答案 0 :(得分:0)
这可能是路径错误。就像我在过去遇到的那样,VS Code不允许您从其终端运行python命令,除非它的路径也已在系统变量中设置。请重新检查这些。
答案 1 :(得分:0)
通过Microsoft安装Python,看来您已经拥有
打开设置ctrl +,搜索python路径并更改python配置> python路径为python3
在“调试”选项卡上,单击“设置”图标,然后将以下代码添加到launch.json文件,保存并确保在“调试”选项卡中将其选择为配置。
{ "name": "Python: Current File (Default Debug)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "none"
}
如果一切顺利,您应该可以从DEBUG CONSOLE`而不是终端进行调试