K
K
kapssss2021-04-27 15:01:27
Python
kapssss, 2021-04-27 15:01:27

Why doesn't running a script in Sublime text 3 work?

If you use import of any module, pressing ctrl+b results in the error No module named ...
And so with any module, when you run simple programs like print('Hello world') everything works.
If you run the program through the command line, everything works.
What could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kapssss, 2021-04-28
@kapssss

1. Open Sublime Text -> Tools -> Build System -> New Build System
2. Paste the following lines into the opened file to make it look like this:
{
"cmd": ["python3", "-i", "-u" , "$file"],
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
"selector": "source.python"
}
3. We save the file with the name python3.sublime-build and do not change the path suggested by the editor
4. Go and check the box Tools -> Build system -> python3

S
soremix, 2021-04-27
@SoreMix

How is the shortcut configured?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question