Biz*_*han 6 python automation build visual-studio-code vscode-code-runner
我刚刚在VS Code上安装了python,但是我无法使用来运行任何python代码 python command。
好像用了 python默认情况下命令,但无法识别命令。
当我右键单击并选择Run Code它时抱怨:
'python' is not recognized as an internal or external command, operable program or batch file
手动运行也是如此 python main.py。
当我打开提升的PowerShell并运行时python,它抱怨:
python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (python:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)
它不会尝试使用py命令,但会识别它。当我手动打电话时py main.py,它可以工作。
当我手动执行时,>py main.py它会写我的Goodbye, World!
如何仅通过使用CodeRunner的右键单击功能(Run Code)在VS Code中进行编译/运行?
我已经在PATH中同时拥有Python文件夹及其Scripts文件夹。
我正在使用,VS Code 1.27.2并且已经安装python 3.7.0在计算机上,并选中了其安装程序复选框以自动添加环境变量。(路径正常)
我还在VS Code上安装了:ms-python.python和tht13.python和formulahendry.code-runner扩展名。
这是我的main.py代码:
print("Goodbye, World!")
Run Code Online (Sandbox Code Playgroud)
原来,我不得不重新启动我的电脑安装后,我ms-python.python和tht13.python和formulahendry.code-runner扩展的VS代码,增加了Python的Scripts文件夹中PATH。
现在,py和python命令都可以在任何地方使用,例如右键菜单中cmd或Run Code右键菜单中。
| 归档时间: |
|
| 查看次数: |
14419 次 |
| 最近记录: |