Python readline
模块的文档说“可用性:Unix”。但是,尽管其他标记为Unix的模块可用,但OS X似乎不可用。下面是我使用的是什么:为什么Python readline模块在OS X上不可用?
$ uname -a Darwin greg.local 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386 $ which python /usr/bin/python $ python Python 2.3.5 (#1, Nov 26 2007, 09:16:55) [GCC 4.0.1 (Apple Computer, Inc. build 5363) (+4864187)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import readline Traceback (most recent call last): File "", line 1, in ? ImportError: No module named readline >>>
我还通过使用MacPorts安装了Python 2.5,但readline
不可有两种。
我该怎么办才能在OS X上为Python的raw_input()
函数提供readline
功能?
正如我所说的,我也通过MacPorts安装了Python 2.5,并且readline在那里不可用。但安装py25-readline工作,谢谢! – 2008-11-29 07:34:54
如果您使用的是MacPorts Python,您可能还想安装'python_select'包来设置默认的Python解释器。 – Cyberdrow 2009-07-12 10:38:31