我有一个想要使用的 anaconda 虚拟环境。我能够使用Select Interpreter
,它可以找到并允许我准确地选择所述虚拟环境。我也可以将它与 jupyter 笔记本一起使用。我不能做的是让集成终端自动激活这个环境。
每次我打开一个新终端时,我都有:
(base) PS C:\working_folder
如果我在集成终端中手动激活环境,我就可以使用它。我的问题是我不想记住手动激活它。
我尝试过的事情:
"Python.terminal.activateEnvironment"
为true
"Python.terminal.activateEnvInCurrentTerminal"
为true
pythonPath
在我的工作文件夹中更新settings.json
打开Powershell并以管理员身份运行,执行以下命令
conda config --set auto_activate_base true
然后重新启动 VS Code,在User Settings.json 中添加以下内容:
"python.defaultInterpreterPath": "\\path\\to\\conda\\python.exe",
"Python.terminal.activateEnvironment": true,
"Python.terminal.activateEnvInCurrentTerminal": true
从命令面板重新加载窗口,选择base:conda
为 python 解释器,然后按Ctrl+Shift+`打开一个新的集成终端,conda 环境应该在其中自动激活。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句