Skip to main content
[Edit removed during grace period]
Source Link
cuonglm
  • 158.1k
  • 41
  • 341
  • 419
Source Link
cuonglm
  • 158.1k
  • 41
  • 341
  • 419

This works for me.

Creating ~/.pythonrc file:

import os
import atexit
import readline

readline_history_file = os.path.join(os.path.expanduser('~'), '.python_history')
try:
    readline.read_history_file(readline_history_file)
except IOError:
    pass

readline.set_history_length(0)
atexit.register(readline.write_history_file, readline_history_file)

Then export it:

export PYTHONSTARTUP=~/.pythonrc