How do I add tab completion to the Python shell?

后端 未结 9 852
甜味超标
甜味超标 2020-11-30 16:41

When starting a django application using python manage.py shell, I get an InteractiveConsole shell - I can use tab completion, etc.

Python 2.5.1         


        
9条回答
  •  抹茶落季
    2020-11-30 17:21

    In Python3 this feature is enabled by default. My system didn't have the module readline installed. I am on Manjaro. I didn't face this tab completion issue on other linux distributions (elementary, ubuntu, mint).

    After pip installing the module, while importing, it was throwing the following error-

    ImportError: libncursesw.so.5: cannot open shared object file: No such file or directory

    To solve this, I ran-

    cd /usr/lib ln -s libncursesw.so libncursesw.so.5

    This resolved the import error. And, it also brought the tab completion in the python repl without any creation/changes of .pythonrc and .bashrc.

提交回复
热议问题