0

Please help me somebody. I've installed python3.10 in Ubuntu 23.04 near python3.11. Than I create virtualenv -p python3.10 And after that interpreter don't recognize my UP/DOWN/LEFT/RIGHT keys

➜ virtualenv -p python3.10 venv
➜ ls                                                   
./  ../  venv/
➜ source venv/bin/activate
➜ python3
Python 3.10.13 (main, Aug 28 2023, 16:45:42) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ^[[B^[[A^[[B^[[A^C
KeyboardInterrupt
>>> 

But when I ran my stock python3.11 interpreter everything is OK

➜ deactivate
➜ which python3
/usr/bin/python3
➜ python3
Python 3.11.4 (main, Jun  9 2023, 07:59:55) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help()
KeyboardInterrupt
>>> 

I've installed python3.10 from source

wget https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz
sudo tar xzf Python-3.10.13.tgz
cd Python-Python-3.10.13
sudo ./configure --enable-optimizations
sudo make altinstall

May be I don't know something that I should write in some config file


➜ sudo apt install libreadline-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libreadline-dev is already the newest version (8.2-1.3).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
  • 2
    BTW: never do sudo tar or compile code as root (and to use only for you, just compile and install on your home: it is much easier). In my opinion is not about readline, but about terminal. Install the **build** dependencies of normal python3, so you will have same support as distribution python (else you just get what building process will find). – Giacomo Catenazzi Aug 31 '23 at 13:38
  • Check out: https://devguide.python.org/getting-started/setup-building/#build-dependencies, just before mac: you will see normal dependencies for Debian/Ubuntu – Giacomo Catenazzi Aug 31 '23 at 13:49
  • @GiacomoCatenazzi No, I've got permission denied when compiler tries to locate to /usr/local/bin – fanishe Aug 31 '23 at 14:14
  • 1
    @He3lixxx I don't know how but `pip3.10 install readline` works. Even after I pip3.10 uninstall readline. I think it's magic – fanishe Aug 31 '23 at 14:16
  • 1
    @fanishe, that's why you use `sudo make install`. You don't need or want `sudo` for any other step until the actual installation -- not for `configure`, not for `make` / the actual build, **only** for the install step. When you use `sudo` too early it puts files in your build tree that only root owns. – Charles Duffy Aug 31 '23 at 14:18
  • Anyhow, what's surprising about this? Readline is one of the most popular libraries for managing keyboard control during input, and if you don't have the headers installed **when you're compiling Python** (installing them later doesn't count!), it can't use them. `pip install readline` works later because then you're building a readline wrapper and installing it into your previously-installed Python, but you wouldn't have had to do that if you'd had readline correctly installed before the configure step. – Charles Duffy Aug 31 '23 at 14:20
  • 1
    Thanks everyone readline lib helps me. I'll write it to my knowlegde base – fanishe Aug 31 '23 at 14:41

0 Answers0