I'm used to ending the python interactive interpreter using Ctrl-d using Linux and OS X. On windows though, you have to use CTRL+Z and then enter. Is there any way to use CTRL+D?
我习惯使用Linux和OS X使用Ctrl-d结束python交互式解释器。但是在Windows上,你必须使用CTRL + Z然后输入。有没有办法使用CTRL + D?
4 个解决方案
#1
Ctrl-d works to exit from IPython
(installed by python(x,y) package).
Ctrl-d用于退出IPython(由python(x,y)包安装)。
- OS: WinXP
- Python version: 2.5.4
Python版本:2.5.4
Edit: I've been informed in the comments by the OP, Jason Baker, that Ctrl-d functionality on Windows OSes is made possible by the PyReadline package: "The pyreadline package is a python implementation of GNU readline functionality it is based on the ctypes based UNC readline package by Gary Bishop. It is not complete. It has been tested for use with windows 2000 and windows xp."
编辑:我在OP的评论中得到了通知,Jason Baker,通过PyReadline包可以实现Windows操作系统上的Ctrl-d功能:“pyreadline包是GNU readline功能的python实现,它基于由Gary Bishop撰写的基于ctypes的UNC readline包。它不完整。它已经过测试,可用于Windows 2000和windows xp。“
Since you're accustomed to *nix you may like that IPython also offers *nix-like shell functionality without using something like Cygwin...
既然你习惯了* nix,你可能会喜欢IPython也提供类似* nix的shell功能而不使用像Cygwin这样的东西...
- Proper bash-like tab completion.
- Use of / instead of \, everywhere
- Persistent %bookmark's
- %macro
- %store. Especially when used with macros and aliases.
- cd -. (easily jump around directory history). Directory history persists across sessions.
- %env (see cookbook)
- Shadow history - %hist and %rep (see cookbook)
- %mglob
- Expansion of $python_variables in system commands
- var = !ls -la (capture command output to handy string lists)
正确的类似bash的标签完成。
使用/而不是\,无处不在
%商店。特别是与宏和别名一起使用时。
cd - 。 (轻松跳转目录历史记录)。目录历史记录在会话中持续存在
%env(见食谱)
阴影历史 - %hist和%rep(参见食谱)
在系统命令中扩展$ python_variables
var =!ls -la(捕获命令输出到方便的字符串列表)
#2
You can't use CTRL+D on windows.
你不能在Windows上使用CTRL + D.
CTRL+Z is a windows-specific control char that prints EOF. On *nix, it is typically CTRL+D. That's the reason for the difference.
CTRL + Z是一个特定于窗口的控件字符,可以打印EOF。在* nix上,它通常是CTRL + D.这就是差异的原因。
You can, however, train yourself to use exit()
, which is cross-platform.
但是,您可以训练自己使用exit(),这是跨平台的。
#3
You can change the key set that Idle should be using.
您可以更改空闲应使用的密钥集。
-
Under Options->"Configure IDLE..." go to the "Keys" tab.
在选项 - >“配置IDLE ...”下,转到“密钥”选项卡。
-
On the right you can select the "IDLE Classic Unix" key set.
在右侧,您可以选择“IDLE Classic Unix”键集。
#4
Run Cygwin Python if windowisms are bothering you... Unless what you are doing depends on pywin32 that is.
如果窗口主义困扰你,运行Cygwin Python ...除非你在做什么取决于pywin32。
#1
Ctrl-d works to exit from IPython
(installed by python(x,y) package).
Ctrl-d用于退出IPython(由python(x,y)包安装)。
- OS: WinXP
- Python version: 2.5.4
Python版本:2.5.4
Edit: I've been informed in the comments by the OP, Jason Baker, that Ctrl-d functionality on Windows OSes is made possible by the PyReadline package: "The pyreadline package is a python implementation of GNU readline functionality it is based on the ctypes based UNC readline package by Gary Bishop. It is not complete. It has been tested for use with windows 2000 and windows xp."
编辑:我在OP的评论中得到了通知,Jason Baker,通过PyReadline包可以实现Windows操作系统上的Ctrl-d功能:“pyreadline包是GNU readline功能的python实现,它基于由Gary Bishop撰写的基于ctypes的UNC readline包。它不完整。它已经过测试,可用于Windows 2000和windows xp。“
Since you're accustomed to *nix you may like that IPython also offers *nix-like shell functionality without using something like Cygwin...
既然你习惯了* nix,你可能会喜欢IPython也提供类似* nix的shell功能而不使用像Cygwin这样的东西...
- Proper bash-like tab completion.
- Use of / instead of \, everywhere
- Persistent %bookmark's
- %macro
- %store. Especially when used with macros and aliases.
- cd -. (easily jump around directory history). Directory history persists across sessions.
- %env (see cookbook)
- Shadow history - %hist and %rep (see cookbook)
- %mglob
- Expansion of $python_variables in system commands
- var = !ls -la (capture command output to handy string lists)
正确的类似bash的标签完成。
使用/而不是\,无处不在
%商店。特别是与宏和别名一起使用时。
cd - 。 (轻松跳转目录历史记录)。目录历史记录在会话中持续存在
%env(见食谱)
阴影历史 - %hist和%rep(参见食谱)
在系统命令中扩展$ python_variables
var =!ls -la(捕获命令输出到方便的字符串列表)
#2
You can't use CTRL+D on windows.
你不能在Windows上使用CTRL + D.
CTRL+Z is a windows-specific control char that prints EOF. On *nix, it is typically CTRL+D. That's the reason for the difference.
CTRL + Z是一个特定于窗口的控件字符,可以打印EOF。在* nix上,它通常是CTRL + D.这就是差异的原因。
You can, however, train yourself to use exit()
, which is cross-platform.
但是,您可以训练自己使用exit(),这是跨平台的。
#3
You can change the key set that Idle should be using.
您可以更改空闲应使用的密钥集。
-
Under Options->"Configure IDLE..." go to the "Keys" tab.
在选项 - >“配置IDLE ...”下,转到“密钥”选项卡。
-
On the right you can select the "IDLE Classic Unix" key set.
在右侧,您可以选择“IDLE Classic Unix”键集。
#4
Run Cygwin Python if windowisms are bothering you... Unless what you are doing depends on pywin32 that is.
如果窗口主义困扰你,运行Cygwin Python ...除非你在做什么取决于pywin32。