vscode python环境搭建
求助:初学python所以装了vscode,结果不管运行什么,终端都报错sytaxerror:invalid syntax,只有全选之后再shift+enter才能正常运行,下图是环境设置以及报错: 你先把code runner插件禁用了重新打开vscode再试,如果没有安装python插件请先安装。我怀疑你是配置code runner插件配置错了。 hrp 发表于 2021-3-15 15:50你先把code runner插件禁用了重新打开vscode再试,如果没有安装python插件请先安装。我怀疑你是配置code ru ...
我试了一下还是不行,应该不是coderunner的问题,我在装code runner之前就有这个问题了{:10_266:}python也装了的 吃鱼丸 发表于 2021-3-15 16:29
我试了一下还是不行,应该不是coderunner的问题,我在装code runner之前就有这个问题了python ...
你打开vscode设置,点击右上角的第二个图标出来一页文本,发上来看看 hrp 发表于 2021-3-15 16:40
你打开vscode设置,点击右上角的第二个图标出来一页文本,发上来看看
{
"python.pythonPath": "C:\\Users\\Liu\\AppData\\Local\\Programs\\Python\\Python39\\python.exe",
"python.formatting.provider": "yapf",
"python.linting.pylintEnabled": true,
"python.linting.pycodestyleEnabled": false,
"python.linting.enabled": true,
"python.linting.pylintArgs": ["--generate-members"],
"python.envFile": "${workspaceFolder}/.env",
"terminal.integrated.env.osx": {
"PYTHONPATH": "${workspaceFolder}",
},
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}",
},
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder}",
},
"code-runner.clearPreviousOutput": true,
//"code-runner.runInTerminal": true,
//如果不开启 无法接受键盘输入
//如果开启 下列命令里 标记“&&”需要改为使用分号“;”
"code-runner.executorMap": {
"javascript": "node",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"php": "php",
"python": "set PYTHONIOENCODING=utf8 && python",
"perl": "perl",
"perl6": "perl6",
"ruby": "ruby",
"go": "go run",
"lua": "lua",
"groovy": "groovy",
"powershell": "powershell -ExecutionPolicy ByPass -File",
"bat": "cmd /c",
"shellscript": "bash",
"fsharp": "fsi",
"csharp": "scriptcs",
"vbscript": "cscript //Nologo",
"typescript": "ts-node",
"coffeescript": "coffee",
"scala": "scala",
"swift": "swift",
"julia": "julia",
"crystal": "crystal",
"ocaml": "ocaml",
"r": "Rscript",
"applescript": "osascript",
"clojure": "lein exec",
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
"racket": "racket",
"scheme": "csi -script",
"ahk": "autohotkey",
"autoit": "autoit3",
"dart": "dart",
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
"haskell": "runhaskell",
"nim": "nim compile --verbosity:0 --hints:off --run",
"lisp": "sbcl --script",
"kit": "kitc --run",
"v": "v run",
"sass": "sass --style expanded",
"scss": "scss --style expanded",
"less": "cd $dir && lessc $fileName $fileNameWithoutExt.css"
},
"code-runner.saveFileBeforeRun": true,
"code-runner.runInTerminal": true,
"leetcode.endpoint": "leetcode-cn",
"leetcode.workspaceFolder": "C:\\Users\\Liu\\.leetcode",
"leetcode.defaultLanguage": "python3",
"workbench.editorAssociations": [
{
"viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb"
}
],
"jupyter.interactiveWindowMode": "perFile",
"code-runner.defaultLanguage": "python",
"window.zoomLevel": -1
} 本帖最后由 hrp 于 2021-3-15 23:26 编辑
吃鱼丸 发表于 2021-3-15 16:44
我用你的配置试了下没有复现问题,应该不是设置的问题。
把你第一张图的第11行:"python": xxxx删掉保存,在左下角显示python版本那里重新选择python解释器,再试试能不能正常工作。 初学 为啥用 Run Coder ??
Microsoft官方Python插件,不香么?
^_
页:
[1]