14

The question:

This post explains how to change which Python installation to run in Spyder under Tools > Preferences > Python Interpreter. One of the options is Default (i.e. same as Spyder's):

enter image description here

But how do you find out what that is?

Some details:

I'm trying to help a colleague run a Python script using a batch file. The script runs just fine from Spyder. But when I'm setting up the batch file, I'm getting the error error importing module Seaborn. So I'm clearly able to run Python (the only python.exe I've found on the system) with the batch setup, but the importing error makes me think that there are more Python installations on the system that I'm not able to detect for some reason, but is being used by Spyder since the very same script does not raise the same error when run from Spyder. I'm a bit confused here, so thank you for any suggestions!

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124
vestland
  • 55,229
  • 37
  • 187
  • 305
  • 1
    Whichever `python.exe` comes packaged with Anaconda. The default installation directory has varied over the last few years for me so I can't really take a stab at where it is (if on Windows, find the path of the Spyder shortcut and it'll be around there). You should be able to point your batch file directly at that source. In terms of versions etc, `Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]` is shown on Spyder start up; you can always see if this differs from a python shell opened in cmd – roganjosh Jan 17 '19 at 11:27

1 Answers1

27

(Spyder maintainer here) To detect the interpreter run by our IPython consoles, you need to run the following code on any of them:

In [1]: import sys                                                                                                                                                         

In [2]: sys.executable                                                                                                                                                     
Out[2]: '/home/carlos/miniconda/envs/py36/bin/python'
Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124