简体   繁体   English

Sublime Text3 构建错误 - 未检测到 Python

[英]Sublime Text3 build error - Python not detected

I'm receiving the error "Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640 [Finished in 0.3s]" when trying to run我在尝试运行时收到错误“找不到 Python 但可以从 Microsoft Store 安装: https ://go.microsoft.com/fwlink?linkID = 2082640 [Finished in 0.3s]”

{
    "cmd": ["python3", "-u", "$file"],
}

I'm very new to python and I've tried other solutions on here with no effect.我对 python 很陌生,我在这里尝试了其他解决方案,但没有任何效果。 I'm also running on a windows 10 PC and made sure to add python 3.9 to path during installation.我也在 Windows 10 PC 上运行,并确保在安装过程中将 python 3.9 添加到路径。 Sublime 3 worked fine initially, but after a using it a couple of times it started showing the error above. Sublime 3 最初运行良好,但在使用它几次后,它开始显示上述错误。 Could it be that I'm using a free version of Sublime?难道我使用的是免费版本的 Sublime?

First check if you can open python from a command prompt:首先检查是否可以从命令提示符打开 python:

  1. Win+R赢+R
  2. Type python and press enter.输入python并按回车键。

If python is open then try to add your custom .sublime-build for python:如果 python 已打开,请尝试为 python 添加自定义.sublime-build

  1. In sublime go to Tools > Build System > New Build System...在 sublime 中,转到 Tools > Build System > New Build System...
  2. Write this on that file:把这个写在那个文件上:
{ 
    "shell_cmd": "python \"$file\""
}
  1. Save it with extension .sublime-build使用扩展名.sublime-build保存它

I believe this is the simplest .sublime-build for python.我相信这是最简单的 python .sublime-build When you press Ctrl+S to save it sublime will show you your sublime user folder.当您按Ctrl+S保存它时,sublime 将显示您的 sublime 用户文件夹。 Save it right there with the name you want.使用您想要的名称将其保存在那里。

Then you will see it on Tools > Build System.然后您将在工具 > 构建系统上看到它。

For more information see Sublime Build System Documentation有关更多信息,请参阅Sublime 构建系统文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM