[Python] Python interpreter doesn't honour .inputrc when run from a venv

Discussão em 'Python' iniciado por Stack, Abril 23, 2025.

  1. Stack

    Stack Membro Participativo

    My .inputrc file, which simply contains set editing-mode vi, means that when I use Bash and some other interpretive environments, I can use Vi editor keys. This also works when I run the system Python interpreter. But when I run the Python interpreter in a venv (Python virtual environment), those key bindings don't work.

    I've actually been using Python, Linux, venv and Vi key bindings for decades, and I don't remember running up against this before a month or two ago, so I wonder if something changed in Python 3.13, or the way venv works starting with that version.

    Question: How can I set up my venv so it honours my .inputrc file, or what else do I need to do so it works?

    My setup:

    • system Python 3.10.12
    • venv Python 3.13.3
    • bash 5.1.16
    • Linux Mint 21.3 Cinnamon

    I create and activate the venv with the following commands:

    python3.13 -m venv venv
    . venv/bin/activate


    I run the Python in the venv just by typing python, and the system python by typing python3. My .inputrc file is in my home directory.

    A curious thing is that the two Python versions share the same command history: Commands I type in the system Python appear when I arrow through the venv Python, and vice-versa, except that in the system Python I can use Escj and Esck, which is what I want.

    Continue reading...

Compartilhe esta Página