How do I repeat the last command? The usual keys: Up, Ctrl+Up, Alt-p don\'t work. They produce nonsensical characters.
(ve)[kakarukeys@localhost ve]$ python
Ipython isn't allways the way... I like it pretty much, but if you try run Django shell with ipython. Something like>>>
ipython manage.py shell
it does'n work correctly if you use virtualenv. Django needs some special includes which aren't there if you start ipython, because it starts default system python, but not that virtual.
If you use Debian Jessie run this to fix your system installation 2.7.9
sudo apt-get install libncurses5-dev libncursesw5-dev
To fix my other 3.5.2
installation which I installed with pyenv :
pip install readline
Sources:
[1] https://www.cyberciti.biz/faq/linux-install-ncurses-library-headers-on-debian-ubuntu-centos-fedora/
[2] https://github.com/yyuu/pyenv/issues/240
[3] https://stackoverflow.com/a/40229934/332788
I don't understand why there are so many long explanations about this. All you have to do is install the pyreadline package with:
pip install pyreadline
sudo port install py-readline (on Mac)
(Assuming you have already installed PIP.)
In my mac os python3 you can use: control+p early command contrlo+n next command
This can happen when you run python script.py
vs just python
to enter the interactive shell, among other reasons for readline being disabled.
Try:
import readline
For repeating the last command in python, you can use <Alt + n>
in windows