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

Question:

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.

Asked By: hakunami

||

Answers:

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.

Answered By: Dietrich Epp

This happens when compiling python without readline support.
Install the readline developement pakckages so that the readline.so module gets build when compiling.

If you want to use ipython on both python2 and python3, you’ll have to install it separately for each interpreter.

One last hint: the ubuntu already has python3 in it’s repository. you can install it using:

sudo apt-get install python3 ipython3
Answered By: mata
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.