vs code python_VSCode:无法识别术语“ python”……但是py可...

在VSCode上安装Python3.7.0后遇到命令行无法识别'python'的问题,即使路径设置正确。'python'命令不可用,但'py'命令可以运行Python代码。使用右键'运行代码'时,CodeRunner报错。解决方案可能涉及配置CodeRunner的执行命令或检查环境变量设置。
摘要由CSDN通过智能技术生成

我刚刚在VS Code上安装了python,但无法使用python命令运行任何python代码.

python命令:

似乎默认情况下使用python命令,但无法识别它.

当我右键单击并选择“运行代码”时,它会抱怨:

无法将“ python”识别为内部或外部命令,可操作程序或批处理文件

手动运行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

py命令:

它不会尝试使用py命令,但可以识别它.当我手动调用py main.py时,它可以工作.

当我手动执行> py main.py时,它会写下我的再见,World!

题:

如何仅使用CodeRunner的右键单击功能(运行代码)使其在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!")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值