Lawrence
Lawrence

Reputation: 960

VSCode loads the wrong python version in the interactive window

I am trying to use the Interactive window of VSCode, but it loads the wrong version of Python. I want it to load the version of the virtual environment (shown bottom left), but it defaults to something else.

I have tried this approach, but I can't simply click the version and change it because it isn't included in the drop down list. I have tried adjusting the settings.json file python.defaultInterpreterPath but that didn't work (perhaps my syntax is wrong). I have also made sure that jupyter is installed in the virtual environment.

I always run VSCode in the project folder from the command line using code . but strangely, something that has worked is running it using code (without the period). This is not a solution however, because the workspace folder is not updated, meaning that when I change the project I'm working on, VSCode opens in previous workspace.

image description

Upvotes: 0

Views: 430

Answers (1)

Steven-MSFT
Steven-MSFT

Reputation: 8431

You can try to delete all the files and folders under this location:

C:\Users\${UserName}\AppData\Roaming\Code\User\globalStorage

Others:

The python interpreter of the .ipynb file was stored in the database located at:

C:\Users\${UserName}\AppData\Roaming\Code\User\workspaceStorage

Such as:

enter image description here

If you open a new .ipynb file in the VSCode which name has not storaged in the database, you will need to select the interpreter.

It's different from the interactive. You can find, any time you reopen the VSCode, the last time you created interactive will be disappear.

Upvotes: 1

Related Questions