0

I use conda in both MacOS default terminal and VS Code integrated terminal, but they use different Python, it's really strange and I don't know how to keep them same.

VS Code terminal:

Documents/GitHub/self-study  master ✗                                                                                                     23h17m ⚑  
▶ conda env list
# conda environments:
#
base                  *  /Users/wsx/Library/r-miniconda
d2l                      /Users/wsx/Library/r-miniconda/envs/d2l
r-reticulate             /Users/wsx/Library/r-miniconda/envs/r-reticulate
sigminer_sigprofiler     /Users/wsx/Library/r-miniconda/envs/sigminer_sigprofiler

(base) 
Documents/GitHub/self-study  master ✗                                                                                                     23h17m ⚑  
▶ which python
/usr/bin/python
(base) 
Documents/GitHub/self-study  master ✗                                                                                                     23h18m ⚑  
▶ which python3
/usr/local/bin/python3
Documents/GitHub/self-study  master ✗                                                                                                     23h18m ⚑  
▶ echo $SHELL
/bin/zsh

MacOS default terminal:

▶ conda env list
# conda environments:
#
base                  *  /Users/wsx/Library/r-miniconda
d2l                      /Users/wsx/Library/r-miniconda/envs/d2l
r-reticulate             /Users/wsx/Library/r-miniconda/envs/r-reticulate
sigminer_sigprofiler     /Users/wsx/Library/r-miniconda/envs/sigminer_sigprofiler

(base) 
~                                                                                                                      
▶ which python
/Users/wsx/Library/r-miniconda/bin/python
(base) 
~                                                                                                                      
▶ which python3
/Users/wsx/Library/r-miniconda/bin/python3
▶ echo $SHELL
/bin/zsh
Shixiang Wang
  • 2,147
  • 2
  • 24
  • 33
  • What are the terminals you use in VS Code and the system? (Cmd or PowerShell or conda terminal). And which environment do you want to use? Please check whether the terminal successfully activates the required conda environment. – Jill Cheng Jan 29 '21 at 08:57
  • @JillCheng I already put such info above. – Shixiang Wang Feb 03 '21 at 01:36

2 Answers2

0

You could check what's the value of this key in your settings.json file

"python.defaultInterpreterPath": "path-used-by-vscode"

You can check this post too.

Guillermo Brachetta
  • 3,857
  • 3
  • 18
  • 36
0

Based on the information you provided, I tested the commands you used.

The result of my test in the cmd terminal inside VS Code is:

enter image description here

The result of my test in the cmd terminal outside VS Code is:

enter image description here

They are similar to the results of your MacOS default terminal. In VS Code, the terminal it uses is integrated from the system's own terminal, so they are basically the same in use.

It is recommended that you check whether the base conda environment is activated on the VS Code terminal. (For example, use the command "python --version" to check if it is python from conda.)

enter image description here

Reference: conda environment in VS Code.

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25