0

Im currently doing a project in VS Code using Jupyter Notebook, however I have some problems with the python interpreter. The problem seem to do with VS Code using two different interpreters.

I have chosen, what I think is the right interpreter, in the upper right corner, namely

[![enter image description here]
(https://i.stack.imgur.com/de6Ot.png)](https://i.stack.imgur.com/de6Ot.png)

However, when I check what version of Python is used in the terminal, then my version is 2.7.17, whereas it should be 3.8.5. I have already tried restarting the kernal, VS Code and changed between other interpreters. I dont know if it has something to do with the Julia env. as shown below:

enter image description here

Can anybody help me understand the problem, and maybe a fix?

JialeDu
  • 6,021
  • 2
  • 5
  • 24
Lyft
  • 37
  • 6

1 Answers1

0

The vscode integrated terminal uses the built-in powershell or cmd of windows. If you type python in the terminal, it will open the interactive terminal of the python version pointed to by the system environment variable. What you choose in the upper right corner of jupyter is just the jupyter notebook kernel, not even the python interpreter for vscode.

Ctrl+Shift+P to open the command palette, search for and select Python:Select Interpreter, then select the interpreter for the python file.

enter image description here

Of course, this operation is only valid for vscode. If you want the terminal to also use the interpreter you selected for vscoe in the Select Interpreter panel, use a virtual environment. When you activate the virtual environment in the vscode terminal, typing python will open the python interactive terminal under the environment.

enter image description here

JialeDu
  • 6,021
  • 2
  • 5
  • 24