DEV Community

Shahriyar Al Mustakim Mitul
Shahriyar Al Mustakim Mitul

Posted on • Updated on

/bin/sh: 1: python: not found in VS Code [Solved]

/bin/sh: 1: python: not found occurs when you have python3 installed . For example, you can check your python version:

Image description
You can see something like this. Now check if you have python3 installed or not.

Image description
It works . If it does not work for you, then install python3 in the latest version.

Follow these steps to install python3:

Step 1: Update and Refresh Repository Lists

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Supporting Software

sudo apt install software-properties-common
Enter fullscreen mode Exit fullscreen mode

Step 3: Add Deadsnakes PPA

sudo add-apt-repository ppa:deadsnakes/ppa
Enter fullscreen mode Exit fullscreen mode

The system will prompt you to press enter to continue. Do so, and allow it to finish. Refresh the package lists again:

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Step 4: Install Python 3
Go to this page and look for the latest version of python3 : https://www.python.org/downloads/

sudo apt install python3.10.4
Enter fullscreen mode Exit fullscreen mode

python3.10.4 was the latest version when I was creating the blog.

Now, check the version

python3 --version
Enter fullscreen mode Exit fullscreen mode

You can read this blog for more ways to install python into Ubuntu.

Now we have python3 installed .
Image description
Still python does not work.
Let's tell our system that python3 is python.

Image description
Now it works perfectly.

Now, go to your VS Code and the problem will be solved.

Top comments (8)

Collapse
 
viditsharma7 profile image
Vidit Sharma

simply use
sudo apt install python-is-python3

Collapse
 
vittor profile image
Vittor Fonseca Serra

Valeu
Salvou muito!

Collapse
 
igorbrizack profile image
Igor Brizack

It worked for me!! Thanks!!!

Collapse
 
hamzahndev profile image
Hamzah nDev

Now it works perfectly !
😊

Collapse
 
srisha2953 profile image
srisha2953

It worked like a charm, Thanks!

Collapse
 
stormytalent profile image
StormyTalent

Perfect!

Collapse
 
viditsharma7 profile image
Vidit Sharma

sudo add-apt-repository ppa:deadsnakes/ppa
return an error
TimeoutError: [Errno 110] Connection timed out

Collapse
 
clivepato93 profile image
clivepato93

thank you