我无法获得在Windows中运行的iPython 0.13.1中显示当前工作目录的提示。如下所示,将当前工作目录更改为'C:\Users\Lou\Documents\Lou's Software\projects\loutilities'
后,\Y3
仅显示'C:/Users/Lou'
。使用\w
和{cwd}
配置可以看到相同的行为。
我确定这是我正在做的蠢事,但我无法弄清楚,或通过Google或Stack Overflow找到任何东西。
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)]
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.
[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing kernel-9572.json
C:/Users/Lou> cd "C:\Users\Lou\Documents\Lou's Software\projects\loutilities"
C:\Users\Lou\Documents\Lou's Software\projects\loutilities
C:/Users/Lou> config PromptManager
PromptManager options
-------------------
PromptManager.color_scheme=<Unicode>
Current: u'Linux'
PromptManager.in2_template=<Unicode>
Current: u' .\\D.: '
Continuation prompt.
PromptManager.in_template=<Unicode>
Current: u'\\Y3> '
Input prompt. '\#' will be transformed to the prompt number
PromptManager.justify=<Bool>
Current: False
If True (default), each prompt will be right-aligned with the preceding one.
PromptManager.out_template=<Unicode>
Current: u'Out[\\#]: '
Output prompt. '\#' will be transformed to the prompt number
托马斯要求输出os.getcwdu()
。我使用config命令来改变提示(我回到了In [#n]
提示符),并且In [#n]
提示仍然存在。一个线索?
In [1]: config PromptManager.in_template='\\Y3'
In [3]: config PromptManager
PromptManager options
-------------------
PromptManager.color_scheme=<Unicode>
Current: u'Linux'
PromptManager.in2_template=<Unicode>
Current: u' .\\D.: '
Continuation prompt.
PromptManager.in_template=<Unicode>
Current: u'\\Y3'
Input prompt. '\#' will be transformed to the prompt number
PromptManager.justify=<Bool>
Current: True
If True (default), each prompt will be right-aligned with the preceding one.
PromptManager.out_template=<Unicode>
Current: u'Out[\\#]: '
Output prompt. '\#' will be transformed to the prompt number
In [4]: import os
In [5]: os.getcwdu()
Out[5]: u'C:\\Users\\Lou'
In [6]: cd weather
(bookmark:weather) -> C:\Users\Lou\Documents\Lou's Software\projects\weather
C:\Users\Lou\Documents\Lou's Software\projects\weather
In [7]: os.getcwdu()
Out[7]: u"C:\\Users\\Lou\\Documents\\Lou's Software\\projects\\weather"
原来的测试重复......
C:/Users/Lou> cd weather
(bookmark:weather) -> C:\Users\Lou\Documents\Lou's Software\projects\weather
C:\Users\Lou\Documents\Lou's Software\projects\weather
C:/Users/Lou> import os
C:/Users/Lou> os.getcwdu()
Out[3]: u"C:\\Users\\Lou\\Documents\\Lou's Software\\projects\\weather"
C:/Users/Lou> config PromptManager
PromptManager options
-------------------
PromptManager.color_scheme=<Unicode>
Current: u'Linux'
PromptManager.in2_template=<Unicode>
Current: u' .\\D.: '
Continuation prompt.
PromptManager.in_template=<Unicode>
Current: u'\\Y3> '
Input prompt. '\#' will be transformed to the prompt number
PromptManager.justify=<Bool>
Current: True
If True (default), each prompt will be right-aligned with the preceding one.
PromptManager.out_template=<Unicode>
Current: u'Out[\\#]: '
Output prompt. '\#' will be transformed to the prompt number
11/21/12 - 检查get_ipython().prompt_manager.templates
:
C:/Users/Lou> pwd
Out[1]: u'C:\\Users\\Lou'
C:/Users/Lou> get_ipython().prompt_manager.templates
Out[2]:
{'in': u'{cwd_y[3]}> ',
'in2': u' .{dots}.: ',
'out': u'Out[{color.number}{count}{color.prompt}]: '}
C:/Users/Lou> cd weather
(bookmark:weather) -> C:\Users\Lou\Documents\Lou's Software\projects\weather
C:\Users\Lou\Documents\Lou's Software\projects\weather
C:/Users/Lou> pwd
Out[4]: u"C:\\Users\\Lou\\Documents\\Lou's Software\\projects\\weather"
C:/Users/Lou> get_ipython().prompt_manager.templates
Out[5]:
{'in': u'{cwd_y[3]}> ',
'in2': u' .{dots}.: ',
'out': u'Out[{color.number}{count}{color.prompt}]: '}