Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change environment of Python Interactive on Vscode?

I recently migrated from Spyder to VScode. I created a new conda environment and used setting.json to change the environment in VScode, "python.pythonPath": "/Users/dcai/anaconda3/envs/alphalens/bin/python"

However when I tried to run the code in Python Interactive, a different environment was loaded.

Is there a way for me to change the Python Interactive environment and match it to my terminal environment?

enter image description here

enter image description here

like image 259
David Avatar asked Jun 06 '19 21:06

David


People also ask

How do I change the Python environment code in Visual Studio?

Right-click Python Environments in Solution Explorer and select Add Environment. In the Browse dialog that appears, navigate to and select the folder that contains the virtual environment, and select OK. If Visual Studio detects a requirements. txt file in that environment, it asks whether to install those packages.

How do I open the Python environment in Visual Studio?

The Python Environments window. The environments that Visual Studio knows about are displayed in the Python Environments window. To open the window, use one of the following methods: Select the View > Other Windows > Python Environments menu command.


1 Answers

The Python Interactive window should be starting up using the Python version selected in the lower left corner of the VS Code IDE. This is the same environment that you can also pick via the Python: Select Interpreter command palette option. However the Python Interactive window does do one thing differently here. If the currently selected environment does not have jupyter installed it will look in the other environments for one that does and launch it, you should see a warning message in this case that a different environment was used.

Did this help answer your question? I'm a developer on this feature so I can help you debug if you are still seeing the wrong env launched.

like image 121
Ian Huff Avatar answered Sep 28 '22 10:09

Ian Huff