【发布时间】:2015-01-24 18:31:43
【问题描述】:
在什么都不做之后,我的 Django 外壳坏了
(virtulenv)miki@blablabla >> python manage.py shell
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
Type "copyright", "credits" or "license" for more information.
IPython 2.3.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.
In [1]:
它将空白符号显示为这些特殊字符,但是当我在这里查看预览时,它没有显示,我将它的图像放在这里...
然而,这不是他唯一的问题。箭头和历史记录不起作用
In [1]: ^[[A^[[B^[[D^[[C
这也发生在普通的 shell 中:
(virtulenv)miki@blablabla >> python manage.py shell --plain
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> ^[[A^[[B^[[D^[[C
我已经尝试安装 readline 并重新编译 python。
想法?
【问题讨论】:
-
你解决了吗?
-
我确实做到了,实际上...我的老板已将其添加到设置中,删除时已修复... sys.stdout = codecs.getwriter('utf8')(sys.stdout) sys.stderr = codecs.getwriter('utf8')(sys.stderr)
-
删除它们并不是一个好主意。我在我的设置文件顶部也添加了这些,因此我的控制台打印出 unicode 字符而没有错误。看看我的回答告诉我它是否适合你。
标签: python django shell ipython