Search code examples
pythonpython-3.xipython

Python3.2 can not recognize UP/DOWN/LEFT/RIGHT keys in interpreter?


I am using ubuntu, linux kernel 2.6.38. I usually use python2, today, I decide to try Python3. I downloads python3 and make install it following the README. However,the python 3.2 interpreter can not recognize UP/SOWN/LEFT/RIGHT keys, these keys are available in my python 2.7 interpreter. What's wrong did I make?

enter image description here

Another question is can I choose the python version which iPython use if I have python2.7 and python3.2 at the same time.

Best Regards.


Solution

  • This happens if the GNU Readline Library is not installed. Install the development version of the Readline library and recompile. (Some Linux distros have different packages for the development version and the runtime version of a library. The development version is needed to compile packages which use the library.)

    On Debian-derived distros like Ubuntu, the package is libreadline-dev.

    sudo apt install libreadline-dev
    

    On Redhat-derived distros like Fedora, the package is named readline-devel.

    sudo dnf install readline-devel
    

    You may be able to use the Editline library instead of Readline. It’s basically a different library that does the same thing.