skip to Main Content

I’ve installed debian 10 on server.

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
ID=debian
arch: x86_64

It had python version 3.7.3 installed on it, so i tried to update it to version 3.8.5 and I want to use checkinstall..
I add backports repo in sources.list and install checkinstall:

# install checkinstall 
sudo apt install checkinstall
sudo apt update

then I get python:

# download python in tar.xz
cd /opt
curl -O https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
tar -xf Python-3.8.5.tar.xz
cd Python-3.8.5

but when I try this

./configure --enable-optimizations
make
# Use the -n flag on make for your target and pipe to shell script
make -n altinstall > altinstall_script.sh
# run checkinstall with that shell script
chmod +x altinstall_script.sh
# and install
sudo checkinstall ./altinstall_script.sh --install

I get error:

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_dbm                                                           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  atexit                pwd                
time                                                           

running build_scripts
copying and adjusting /opt/Python-3.8.5/Tools/scripts/pydoc3 -> build/scripts-3.8
copying and adjusting /opt/Python-3.8.5/Tools/scripts/idle3 -> build/scripts-3.8
copying and adjusting /opt/Python-3.8.5/Tools/scripts/2to3 -> build/scripts-3.8
changing mode of build/scripts-3.8/pydoc3 from 644 to 755
changing mode of build/scripts-3.8/idle3 from 644 to 755
changing mode of build/scripts-3.8/2to3 from 644 to 755
renaming build/scripts-3.8/pydoc3 to build/scripts-3.8/pydoc3.8
renaming build/scripts-3.8/idle3 to build/scripts-3.8/idle3.8
renaming build/scripts-3.8/2to3 to build/scripts-3.8/2to3-3.8
running install_lib
copying build/lib.linux-x86_64-3.8/_multibytecodec.cpython-38-x86_64-linux-gnu.so -> /usr/local/lib/python3.8/lib-dynload
error: [Errno 2] No such file or directory
rm: cannot remove '/usr/local/lib/python3.8/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py': No such file or directory
rm: cannot remove '/usr/local/lib/python3.8/lib-dynload/__pycache__': No such file or directory
Creating directory /usr/local/share/man/man1
Looking in links: /tmp/tmpaf3jv392
Processing /tmp/tmpaf3jv392/setuptools-47.1.0-py3-none-any.whl
Processing /tmp/tmpaf3jv392/pip-20.1.1-py2.py3-none-any.whl
Installing collected packages: setuptools, pip
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory

C

2

Answers


  1. Chosen as BEST ANSWER

    This seemed to work for me: install pyenv and use this for install python3.8.5.

    I ran the following commands:

    # Install pyenv
    curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
    
    # Load pyenv automatically by adding the following to ~/.bashrc:
    export PATH="$HOME/.pyenv/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
    
    # Check versions
    pyenv install --list | grep " 3.[678]"
    # install python 3.8.5
    pyenv install -v 3.8.5
    # set python 3.8.5
    pyenv global 3.8.5
    
    # Now I can use python2 and python3
    python2 -V    # -> Python 2.7.16
    python3 -V    # -> Python 3.8.5
    python -V     # -> Python 3.8.5
    pip -V        # -> pip 20.1.1 from /root/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pip (python 3.8)
    pip2 -V       # -> pip 20.2.1 from /root/.local/lib/python2.7/site-packages/pip (python 2.7)
    pip3 -V       # -> pip 20.1.1 from /root/.pyenv/versions/3.8.5/lib/python3.8/site-packages/pip (python 3.8)
    
    # or return to system python
    pyenv global system
    # and then 
    python2 -V    # -> Python 2.7.16
    python -V     # -> Python 2.7.16
    python3 -V    # -> Python 3.8.5
    
    # and versions
    pyenv versions
    

    Maybe, you need also install dependencies:

    sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev 
    libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev 
    xz-utils tk-dev libffi-dev liblzma-dev
    

  2. I think you made a mistake in listing the version you want to install it to look at this guide for more information –
    https://linuxize.com/post/how-to-install-python-3-8-on-debian-10/

    $ python3.8 --version
    

    Adding this piece of code should help.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search