小编Mic*_*man的帖子

将颜色添加到新样式ipython(v5)提示符

立即更新到新发布的ipython5.启动交互式提示并收到:

/usr/local/lib/python3.5/site-packages/IPython/core/interactiveshell.py:440: UserWarning: As of IPython 5.0 `PromptManager` config will have no effect and has been replaced by TerminalInteractiveShell.prompts_class
warn('As of IPython 5.0 `PromptManager` config will have no effect'
Run Code Online (Sandbox Code Playgroud)

拉出我的旧配置设置来自定义和着色提示,然后寻找新的方式来自定义提示并找到它,非常酷.使用示例代码中的新类样式:

class MyPrompt(Prompts):
    def in_prompt_tokens(self, cli=None):
        return [(Token, os.getcwd()),
                (Token.Prompt, ' >>>')]
Run Code Online (Sandbox Code Playgroud)

把它放到一个启动脚本中它运行得很好,除了它默认不着色令牌行,Token.Prompt变成浅绿色.

尝试使用旧的配置方法颜色(r'{color.Green}')但这在这里不起作用.任何正确方向的指针都会很棒.

谢谢!

python ipython python-3.x

10
推荐指数
1
解决办法
1211
查看次数

标签 统计

ipython ×1

python ×1

python-3.x ×1