How to select Python 3 in Visual code

Asked

Viewed 1,755 times

1

I already installed the Python extension in Vscode but I want to know how to recognize the Python 3 syntax?

  • 1

    Synthesis? Or syntax?

  • 1

    There are more than one VS code extension available Felipe, can indicate which one you are using?

  • @gmsantos I am using python, which is in recommended

  • What is the name of the author of the extension? Don Jayamanne? I need to know exactly what the extension is because the configuration varies between them.

  • @gmsantos yes, that of Don Jayamanne

2 answers

1

In some cases, the problem may be in the current Python of VS Code. To change it, simply click on the current version of Python in the lower left corner of Vs Code:

Versão corrente do Python

Then select the desired version:

Menu de seleção do VS Code

0

Open Settings and add the following key:

"pythonPath": "/usr/bin/python3",

But the correct way would be to go to the folder of your project, create a virtualenv like this:

virtualenv --python=/usr/bin/python3 venv

enable the virtual env

source venv/bin/activate

and then give command

code .

so the visual studio code will open all files from that folder using virtualenv python as interpreter.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.