Django shell 中的奇怪字符,箭头键不起作用
Strange characters in Django shell, arrowkeys not working
在不做任何异常操作后,我的 Django shell 坏了
(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]:
它显示白色符号 space 作为这些特殊字符,但是当我在这里查看预览时,它没有显示,我将它的图像放在这里...
然而,这不是他唯一的问题。箭头和历史不起作用
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。
想法?
你的终端坏了。 $TERM
的当前值,假设有一个,与正在使用的终端不匹配。
我想通了...
老板把这个添加到设置中,这是由于生产编码造成的。我添加了条件并在我的电脑上设置了环境变量,它是固定的...
if not os.environ.get("DISABLE_UTF8_REDEFINE"):
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
在长期遭受相同问题的困扰后 I found out that installing bpython or ipython 不仅解决了问题,而且通过语法高亮、自动缩进、建议自动完成和许多其他奇特的东西让我的调试生活变得更加轻松.
只需安装 bpython
pip install bpython
或ipython
pip install ipython
我个人推荐 bpython 而不是 ipython,因为它更轻便,而且正是您想要的。
在不做任何异常操作后,我的 Django shell 坏了
(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]:
它显示白色符号 space 作为这些特殊字符,但是当我在这里查看预览时,它没有显示,我将它的图像放在这里...
然而,这不是他唯一的问题。箭头和历史不起作用
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。
想法?
你的终端坏了。 $TERM
的当前值,假设有一个,与正在使用的终端不匹配。
我想通了...
老板把这个添加到设置中,这是由于生产编码造成的。我添加了条件并在我的电脑上设置了环境变量,它是固定的...
if not os.environ.get("DISABLE_UTF8_REDEFINE"):
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
在长期遭受相同问题的困扰后 I found out that installing bpython or ipython 不仅解决了问题,而且通过语法高亮、自动缩进、建议自动完成和许多其他奇特的东西让我的调试生活变得更加轻松.
只需安装 bpython
pip install bpython
或ipython
pip install ipython
我个人推荐 bpython 而不是 ipython,因为它更轻便,而且正是您想要的。