[英]VSCode Mac shows incorrect interpreter even after activation of environment
I am new to VSCode so I was trying to use the existing conda environments as part of my project in VSCode.我是 VSCode 的新手,所以我试图将现有的 conda 环境用作我在 VSCode 中的项目的一部分。 I was able to use Shift+Cmd+P
to select the relevant interpreter我能够使用Shift+Cmd+P
来选择相关的解释器
(in this case named
mlops
, as visible at the bottom right of the image below) (在本例中名为mlops
,如下图右下方所示)
I was able to test that after selecting the interpreter, my code was actually using this, as displayed in the left side terminal window using the code below -在选择解释器后,我能够测试,我的代码实际上正在使用它,如左侧终端窗口中所示,使用下面的代码 -
import sys
print("Interpreter:")
print(sys.executable)
Finally, I then went to another bash terminal (right side) and activated the conda environment.最后,我然后去了另一个 bash 终端(右侧)并激活了 conda 环境。 But, when I checked which python
it still points to the wrong interpreter.但是,当我检查which python
时,它仍然指向错误的解释器。
I have gone through a large number of questions and solutions to solve this issue and most of them point to adding terminal.integrated.inheritEnv
as False
in the settings.json
我已经经历了大量的问题和解决方案来解决这个问题,其中大多数指向在settings.json
中将terminal.integrated.inheritEnv
添加为False
But it doesn't seem to fix the issue.但这似乎无法解决问题。
My question is 2 fold:我的问题是2折:
This is a common problem.这是一个常见的问题。 Switching between different environments will lead to confusion in the environment.在不同环境之间切换会导致环境混乱。
What we need to do is to deactivate all environments and then reactivating conda environment .我们需要做的是停用所有环境,然后重新激活 conda environment 。
You can refer to this issue which is the same to your problem for more information.您可以参考与您的问题相同的此问题以获取更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.