This question already has answers here:
Ampersand “&” syntax error running any Python script in VSCode?
(4个答案)
9个月前关闭。
每当我尝试对弹出的每个python文件使用弹出菜单中的“在终端中运行Python文件”选项时,Visual Studio代码都会出现错误。
我有。
我:\ Python \ HelloWorld>&
C:/用户/ jdhoc / AppData /本地/程序/Python/Python37/python.exe
i:/Python/HelloWorld/helloworld.py&目前是意外的。
![python - 在终端中运行Python文件失败,并且是意外的-LMLPHP python - 在终端中运行Python文件失败,并且是意外的-LMLPHP]()
我仍然可以在终端上执行以下操作:例如,python helloworld.py,它可以工作。
在安装emojisense扩展并将其添加到我的settings.json文件中之后,这个问题就开始了。
我从为emojisense添加的setting.json中删除了行,但行不起作用。我还卸载了Visual Studio代码并重新安装,但也没有解决问题。我也包括了settings.json文件。我确定将emojisense内容复制到settings.json时可能会搞砸,但现在不确定如何解决。
任何帮助,将不胜感激!!
(4个答案)
9个月前关闭。
每当我尝试对弹出的每个python文件使用弹出菜单中的“在终端中运行Python文件”选项时,Visual Studio代码都会出现错误。
我有。
我:\ Python \ HelloWorld>&
C:/用户/ jdhoc / AppData /本地/程序/Python/Python37/python.exe
i:/Python/HelloWorld/helloworld.py&目前是意外的。
我仍然可以在终端上执行以下操作:例如,python helloworld.py,它可以工作。
在安装emojisense扩展并将其添加到我的settings.json文件中之后,这个问题就开始了。
"emojisense.languages": {
"markdown": true,
"plaintext": {
"markupCompletionsEnabled": false,
"emojiDecoratorsEnabled": false
},
"git-commit": true
},
"emojisense.unicodeCompletionsEnabled": true,
"emojisense.markupCompletionsEnabled": true,
我从为emojisense添加的setting.json中删除了行,但行不起作用。我还卸载了Visual Studio代码并重新安装,但也没有解决问题。我也包括了settings.json文件。我确定将emojisense内容复制到settings.json时可能会搞砸,但现在不确定如何解决。
任何帮助,将不胜感激!!
{
"files.autoSave": "afterDelay",
"python.linting.enabled": true,
"python.pythonPath":"C:\\Users\\jdhoc\\AppData\\Local\\Programs\\Python\\Python37\\python.exe",
"editor.minimap.enabled": false,
"editor.formatOnSave": true,
"editor.fontSize":16,
"workbench.iconTheme": "ayu",
"workbench.colorTheme": "Predawn",
"workbench.settings.editor": "json",
"workbench.settings.openDefaultSettings": true,
"workbench.startupEditor": "newUntitledFile",
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"liveServer.settings.donotShowInfoMsg": true,
"liveSassCompile.settings.formats":[
{
"format": "compressed",
"extensionName": ".min.css",
"savePath": "/dist/css"
}],
"liveSassCompile.settings.generateMap": false,
"prettier.jsxSingleQuote": true,
"prettier.singleQuote": true,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
}
}
最佳答案
这不仅是一个通知,还是最新的Python-Extension版本中的一个错误,因为除非您在终端中手动删除命令前的附加&,否则python解释器不会启动。它与表情符号无关。
您可以在此处找到有关此问题的另一篇(重复的)帖子:
Ampersand “&” syntax error running any Python script in VSCode?
该问题现已通过Python扩展的2019.5.18678版本(2019年6月5日)解决。
关于python - 在终端中运行Python文件失败,并且是意外的,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56453888/