How to check which Python interpreter Spyder is running on its console?

折月煮酒 提交于 2021-02-08 13:59:16

问题


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):

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!


回答1:


(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'


来源:https://stackoverflow.com/questions/54234698/how-to-check-which-python-interpreter-spyder-is-running-on-its-console

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!