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?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With