syntax highlighting in ipython console

I am using ipython both in qtconsole and in the terminal

In ipython-qtconsole , when I type import pandas as pd the words have syntax highlighting.

However, when I type in the console, all text is white

Is it possible to have syntax highlighting in python console as well?

my ipython versions are;

ipython                    1.2.1
ipython-qtconsole          1.2.1

Yes, if you use IPython 5.0 or above, It makes uses of Python Prompt Toolkit which does highlight code as you type, as well as support real, and sane multi-line edition.

To upgrade use :

pip install  ipython --upgrade

This is based on the work of Jonathan Slenders on ptpython:

python -m pip install ptpython

which provide 2 commands: ptpython and ptipython which should syntax highlight in your terminal. ptipython is a proof of concept so will likely miss some functionality of IPython, but push the interface a bit further.

Note that jupyter-console, which can connect to IPython as a kernel will also make use of prompt toolkit and highlight code as you type.


Jupyter, ipython的笔记本电脑的副产品,提供了命令jupyter console ,这正是你(和我)正在寻找的东西。

链接地址: http://www.djcxy.com/p/68940.html

上一篇: 如何将python3内核添加到jupyter(IPython)

下一篇: 语法突出显示在ipython控制台中