1

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

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

I'm very new to python and I've tried other solutions on here with no effect. I'm also running on a windows 10 PC and made sure to add python 3.9 to path during installation. Sublime 3 worked fine initially, but after a using it a couple of times it started showing the error above. Could it be that I'm using a free version of Sublime?

10
  • 1
    Goto tools, build with> then select python. If it still doesn't work then uninstall python, download and install an earlier version of python like 3.7, and select custom installation, make sure everything is selected. Then goto tools> Build System> Python3. And Tools> Build with> Python Commented Oct 13, 2020 at 2:46
  • @shakhyar.codes why would installing an earlier version of Python change anything? Commented Oct 13, 2020 at 15:58
  • Have you tried using the Python build system that's already available under Tools → Build System → Python? How did you install Python originally? Commented Oct 13, 2020 at 16:01
  • Because latest version might still have some bugs, 3.7 is used all over the world widely, so sublime might needs update to build the latest version. But I would suggest not using the sublime build, as you should run the script from command prompt or terminal, which is better Commented Oct 14, 2020 at 4:16
  • 1
    @shakhyar.codes "Because latest version might still have some bugs, 3.7 is used all over the world widely, so sublime might needs update to build the latest version. But I would suggest not using the sublime build, as you should run the script from command prompt or terminal, which is better" - works fine this way, but really hoping to resolve this too, maybe achieve some sense of accomplishment and learn something lol Commented Oct 15, 2020 at 4:01

1 Answer 1

3

First check if you can open python from a command prompt:

  1. Win+R
  2. Type python and press enter.

If python is open then try to add your custom .sublime-build for python:

  1. In sublime go to Tools > Build System > New Build System...
  2. Write this on that file:
{ 
    "shell_cmd": "python \"$file\""
}
  1. Save it with extension .sublime-build

I believe this is the simplest .sublime-build for python. When you press Ctrl+S to save it sublime will show you your sublime user folder. 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

Sign up to request clarification or add additional context in comments.

2 Comments

There is already a Python.sublime-build that ships with Sublime. Why are you recommending making a new one with fewer features like error messages? Also, when you run Python from Sublime, you need to use the -u flag.
I recommended this because it is simple it's just running the program without making any regex match and that other stuff. Also -u is not completely necessary (it is just to force the stdin, stdout and stderr to to be unbuffered), I have used that specific build a lot of time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.