【发布时间】:2014-07-18 01:06:25
【问题描述】:
在 iPython 中看到一些奇怪的行为,这似乎取决于它的启动方式。在终端中启动时,某些 shell 命令可以工作 (pwd),但 'ls' 和 '!ls' 都会出错 - 请参阅下面的 OSError Traceback §。
当使用 Qtconsole 启动时:“ipython qtconsole --pylab=inline”,一切似乎都很好。
[附加信息:当 ipython 作为笔记本启动时,shell 命令可以正常工作。]
[附加信息#2:“iptest core”产生4个错误——都与文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”有关]
有什么建议吗?谢谢!运行 Python 2.7.5、IPython 2.1.0、Mac OSX Mavericks。
...
/Library/Python/2.7/site-packages/IPython/core/interactiveshell.pyc in system_raw(self, cmd)
2277 cmd = py3compat.unicode_to_str(cmd)
2278 # Call the cmd using the OS shell, instead of the default /bin/sh, if set.
-> 2279 ec = subprocess.call(cmd, shell=True, executable=os.environ.get('SHELL', None))
2280 # exit code is positive for program failure, or negative for
2281 # terminating signal number.
OSError: [Errno 2] No such file or directory
【问题讨论】: