本文介绍了你如何在 Vscode 上更改 Python Interactive 的环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从 Spyder 迁移到 VScode.我创建了一个新的 conda 环境并使用 setting.json 来更改 VScode 中的环境,"python.pythonPath": "/Users/dcai/anaconda3/envs/alphalens/bin/python"

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"

但是,当我尝试在 Python Interactive 中运行代码时,加载了不同的环境.

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

有没有办法让我更改 Python Interactive 环境并将其与我的终端环境相匹配?

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

推荐答案

Python 交互窗口应该使用在 VS Code IDE 左下角选择的 Python 版本启动.这与您也可以通过 Python 选择的环境相同:选择解释器命令面板选项.然而,Python Interactive 窗口在这里做的事情有所不同.如果当前选择的环境没有安装 jupyter,它将在其他环境中查找安装并启动它的环境,在这种情况下,您应该看到一条警告消息,表明使用了不同的环境.

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.

这是否有助于回答您的问题?我是此功能的开发人员,因此如果您仍然看到错误的 env 启动,我可以帮助您进行调试.

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.

这篇关于你如何在 Vscode 上更改 Python Interactive 的环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 09:59