@
hatcloud 安装: $ pip install prompt-toolkit
运行: $ ptpython
------------------------------------------
如果不行的话,
1. 我这边的 ptpython是是在 /usr/local/bin/ptpython 中的, 可以看看有没有
2. find 或者 locate 看有没有ptpython这个文件. 建议: $ sudo updatedb; sudo locate ptpython (find 太慢了...)
------------------------------------------
另外, 如果输入多行语句的话 "Enter"键的作用是换行; "Alt+Enter"是执行
In [4]: if True: //这里按"Enter"键, 换行
2. print("Hello World!"); // 按"Alt+Enter", 执行
Hello World!
参考:
Multiline editing
Usually, multi-line editing mode will automatically turn on when you press enter after a colon, however you can always turn it on by pressing F7.
To execute the input in multi-line mode, you can either press Alt+Enter, or Esc followed by Enter. (If you want the first to work in the OS X terminal, you have to check the "Use option as meta key" checkbox in your terminal settings. For iTerm2, you have to check "Left option acts as +Esc" in the options.)