I changed my operating system on Ubuntu 2 weeks ago. I installed Visual Studio Code and an extension Code Runner. When i wanted to run a code i got a following information:
/bin/sh: 1: python: not found
I searched the internet and i found that i have to print at the beginning of my code:
#!/usr/bin/python3
My question is can i change it somewhere in VSCode settings or somewhere else so as not to print this sequence whenever i want to make a new project. Also when I had this extension on Windows i didn't have such a problem. Moreover when i run code in C++ or in other languages i don't have this problem, i have it only in Python. Also i don't have this problem without Code Runner extension. I have it only with Code Runner extension and when i want to run Python code. Picture to visualize a problem.
What the problem here is that, in most of GNU/Linux os, the command for python if you're running python3 is
python3
instead of as in windows simplypython
, the simplepython
command only works for python2 in linux. So you can do 2 things first, go to~/.bashrc
, open it in any text editor, at the end add thisor if you don't want to add an alias, you can make
python
topython3
in code runner, to do this, do this:python -u
topython3 -u