2

我的电脑上安装了几个版本的 python:

$ which ipython
/usr/local/share/python/ipython
$ ipython
Python 2.7.3 (default, Nov 28 2012, 13:43:07) 

$ which python
/usr/bin/python
$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 

我想找到在我的 ipython 下运行的 python bin。感谢您的帮助

4

2 回答 2

8
In [1]: import sys

In [2]: sys.version
Out[2]: '2.7.2 |EPD_free 7.2-2 (32-bit)| (default, Sep 14 2011, 11:02:05) [MSC v.1500 32 bit (Intel)]'

In [3]: sys.executable
Out[3]: 'C:\\Python27\\python2.7.exe'
于 2013-01-24T11:48:33.960 回答
3

尝试这个:

head -n 1 $(which ipython)
于 2013-01-24T11:39:41.710 回答