I
I
Igor Malyga2016-10-20 23:15:27
Python
Igor Malyga, 2016-10-20 23:15:27

How to run Python code in Sublime?

I started learning python, chose Sublime 3 as an IDE, but ran into a compilation problem, if I may say so. When you press the ctrl + b key combination, only the program execution time is displayed on the console, but nothing else, what's the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Klimovich, 2016-10-21
@SmallMiracle

Sublime text is a wonderful thing, you can make full-fledged IDEs even for all programming languages.
The whole setup comes down to installing Pasckage Control and the SublimeREPL extension, creating a new build sustem, with the content
{
"target": "run_existing_window_command",
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
And editing the file "config/Python/Main.sublime-menu" in the directory depending on the system
If Windows then:
C:\User\User\AppData\Roaming\Sublime Text 3\Packages\User\SublimeREPL-python.sublime- build
Linux:
/home/User/.
{"command": "repl_open",
"caption": "Python - RUN current file",
"id": "repl_python_run",
"mnemonic": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python3", "-u", "-i", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python /Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8" }
}the difference will be only in the line "cmd": ["python3", "-u", "-i", "$file_basename"]

A
Alexander, 2016-10-20
@kentuck1213

Open Terminal , enter the version of Python there, then the path with the name of the file with the script.
Example:
python3.5 my-file.py

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question