Answer the question
In order to leave comments, you need to log in
FileNotFoundError(2, "No such file or directory:'python'") when running python code?
Installed Linux Mint 20.1 XfCE on a laptop, updated drivers and programs through the package manager. I installed Sublime, activated it with a key from the network, tried to run the python3 code, an error came up: "bash: python: command not found", checked if there was at all (although I was sure that there was) python in the package manager (which is on Synaptic'e ), python exists and does not ask for updates. I decided to install Sublime REPL, but it didn't help either: "FileNotFoundError(2, "No such file or directory: 'python'"). On the command line or with other interactions with python3, the error is: "bash: python: command not found". Solved install separately Python 3.9.1., but didn't help.If
"Key Bindings" in Sublime:
[
{ "keys": ["ctrl+b"], "command": "
"id": "repl_python_run",
"mnemonic": "d",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python", "-i" , "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING ":"utf-8"}
}
}
]
Answer the question
In order to leave comments, you need to log in
Tools -> Build System -> New Build System
Next:
{
"cmd": ["python3", "-i", "-u", "$file"],
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
"selector": "source.python"
}
Python3.sublime-build
in Tools -> Build System, select "Python3". That's it, now you can run Python scripts with CTRL+B. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question