如何在 VSCode 中运行 python3 代码?/bin/sh: 1: python: 未找到 [英] How to run python3 code in VSCode? /bin/sh: 1: python: not found
问题描述
我正在尝试使用 python3 在 VSCode 中运行 python 文件.
我知道我可以通过简单地设置为使用集成终端来解决问题,就像
标准编码器运行器 launch.json
看起来像这样;
"version": "0.2.0",配置":[{"name": "Python:当前文件",类型":蟒蛇",请求":启动","program": "${file}",控制台":集成终端"}]
我尝试在 settings.json
<代码>..."python.pythonPath": "python3",code-runner.executorMap":{"python3": "/usr/bin/python3"}
我还为 python -> python3 设置了别名(因为我的 ubuntu 20.04 不再带有 python2)
别名 python="python3"
但是,我不断收到上述错误.有什么想法吗?
差不多了.这段代码
<代码>...python.pythonPath":python3",code-runner.executorMap":{python3":/usr/bin/python3"}
应该
<代码>...python.pythonPath":python3",code-runner.executorMap":{python":/usr/bin/python3";}
I'm trying to run a python file in VSCode using python3.
I know I can fix by simply setting to run using integrated terminal like it says in the microsoft vscode tutorial on python. However, I would like the program to print in the output tab and not take up the terminal window.
The standard coder runner launch.json
looks like this;
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
I've tried to set my python path in VSCode in settings.json
...
"python.pythonPath": "python3",
"code-runner.executorMap": {
"python3": "/usr/bin/python3"
}
I've also set an alias for python -> python3 (as my ubuntu 20.04 doesn't come with python2 anymore)
alias python="python3"
However, I keep getting the above error. Any Ideas?
Nearly had it. This code
...
"python.pythonPath": "python3",
"code-runner.executorMap": {
"python3": "/usr/bin/python3"
}
should be
...
"python.pythonPath": "python3",
"code-runner.executorMap": {
"python": "/usr/bin/python3"
}
这篇关于如何在 VSCode 中运行 python3 代码?/bin/sh: 1: python: 未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!