Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code Python installation and Python Interpreter not recognized

I am getting this message on the VS Code that "Python is not installed. Please download and install python before using the extension."

There is also no *"Python Interpreter"* to select. When I click on it it shows it empty.

I do have Python and Python extension installed and I do have virtual environments set up in the Anaconda navigator but for some reason, I am not able to use them. I tried many ways like reinstalling the Python, Anaconda, and VS Code and also the Python extension for VS code but it's not solving the issue. What could be the reason? I have attached a screenshot of the VS Code as well. Pleae click here to see the screenshot

Thanks for your help.

like image 845
codewithawais Avatar asked Nov 07 '22 07:11

codewithawais


2 Answers

I tried many methods but none worked. So then I removed this extension "Anaconda Extension Pack by Microsoft" and it solved the issue. So anyone facing the same issue might try uninstalling this extension.

like image 192
codewithawais Avatar answered Nov 14 '22 21:11

codewithawais


I once faced similar problem and i found out that by default vs code looks for /usr/bin/python however in some cases on linux and mac the path is /usr/bin/python3 or 2 , so you can fix it by declaring python3 as default version .

open terminal and type the following command

sudo apt install python-is-python3

check the installation using -

python --version

it should give the output as 3.x.x

like image 41
loadingbar Avatar answered Nov 14 '22 21:11

loadingbar