Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ipython:暂时转到shell,稍后返回当前ipython会话_Python_Windows_Ipython - Fatal编程技术网

ipython:暂时转到shell,稍后返回当前ipython会话

ipython:暂时转到shell,稍后返回当前ipython会话,python,windows,ipython,Python,Windows,Ipython,我正在从Windows命令行运行ipython。我想知道ipython中是否有一个功能允许我临时转到shell(cmd.exe),然后返回当前的ipython会话 我知道使用“!”来执行shell命令。但那不是我想要的 人们提出了一个可行的解决方案,所以我回答了。您可以通过执行命令来启动一个新的控制台shell!iPython中的cmd。当您退出该控制台时,将返回iPython提示符 这类似于UNIX使用的技巧!sh或!bash创建子shell。人们评论并建议了一种有效的方法-使用!cmd或!p

我正在从Windows命令行运行ipython。我想知道ipython中是否有一个功能允许我临时转到shell(cmd.exe),然后返回当前的ipython会话

我知道使用“!”来执行shell命令。但那不是我想要的


人们提出了一个可行的解决方案,所以我回答了。

您可以通过执行命令
来启动一个新的控制台shell!iPython中的cmd
。当您退出该控制台时,将返回iPython提示符


这类似于UNIX使用
的技巧!sh
!bash
创建子shell。

人们评论并建议了一种有效的方法-使用!cmd或!powershell启动新的命令会话,并通过退出该shell返回

例如:

C:\>ipython
Python 2.7.2 (default, Jun 24 2011, 12:22:14) [MSC v.1500 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:

In [1]: !cmd
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\>exit

In [2]:

你的意思是除了使用
运行shell命令?@MartijnPieters是的,除此之外。谢谢你的提醒。我自己从来不使用Windows,但会
!cmd.exe
有什么有用的吗?试试
!开始
,可能会有用。既然你已经找到了解决方案,你可以把它作为你自己问题的答案。