VS代码:无法在Python Interactive上加载anaconda环境 [英] VS Code: Can't load anaconda environment on Python Interactive
问题描述
我在Windows 10中使用VS Code.
如果在Terminal中运行Python脚本,则可以在conda环境中使用依赖项.但是,我无法在Python Interactive Shell中使用该环境.
I am using VS Code in Windows 10.
I am able to use the dependencies in my conda environment if I Run the Python Script in Terminal. However, I am not able to use the environment in the Python Interactive shell.
例如,我正在使用我的 datascience
环境,该环境具有软件包 fuzzywuzzy
.我已经将env路径作为 python.pythonPath
包含在 settings.json
中.但是Jupyter Notebook中使用的Python版本是默认的anaconda基础 C:\\ ProgramData \\ Anaconda3 \\ python.exe
For instance, I am using my datascience
environment which has the package fuzzywuzzy
. I have included the env path into the settings.json
as the python.pythonPath
. But the Python version used in the Jupyter Notebook is the default anaconda base C:\\ProgramData\\Anaconda3\\python.exe
还有一个扩展,就是如果我在Notebook中运行!conda list
,我会看到 fuzzywuzzy
包.
What is also extrange, is that if I run !conda list
within the Notebook, I can see the fuzzywuzzy
package.
我想念什么?
谢谢!
推荐答案
我是Interactive Windows上的开发人员.Priyatham已经为您指明了正确的方向.当前,我们的Window尝试使用当前选定的环境(左下角的一个).但是,如果客户没有在每个环境中都安装Jupyter,我们就不会完全阻止他们.因此,如果所选解释器的环境中没有Jupyter,我们将检查系统上的其他环境,寻找与当前所选工具最匹配的python版本.如果我们使用Jupyter找到了一些东西,我们将使用它启动交互窗口".在这种情况下,我们确实在右下方显示了一个弹出窗口,表明我们没有找到Jupyter,而我们又回到了另一个环境,但是此消息很容易被忽略.
I'm a developer on the Interactive Windows. Priyatham has already pointed you in the right direction. Currently our Window tries to use the currently selected environment (the one in the lower left corner). But we didn't want to totally block customers if they didn't have Jupyter installed in each environment. So if the selected interpreter doesn't have Jupyter in the environment we'll check other environments on the system, looking for the closest python version match to the currently selected one. If we find something with Jupyter we'll launch the Interactive Window using that. In this case we do show a popup in the lower right indicating that we didn't find Jupyter and that we are falling back on a different environment, but this message can be pretty easy to miss.
这篇关于VS代码:无法在Python Interactive上加载anaconda环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!