Debian installs different versions of python such as 3.8

To install Python 3.8 on Debian, you can follow these steps:

  1. Make sure your Debian system has been updated to the latest version, you can use the following command to update:

    sudo apt update
    sudo apt upgrade
    
  2. Install the dependencies for Python 3.8, as well as the tools and libraries needed to build Python:

    sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev
    
  3. Download the source code package for Python 3.8:

    wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz
    
  4. Unzip the source code package:

    tar -xf Python-3.8.12.tgz
    
  5. Enter the decompressed directory:

    cd Python-3.8.12
    
  6. Configure Python compilation options:

    ./configure --enable-optimizations
    
  7. Compile and install Python:

    make -j 4
    sudo make altinstall
    

    Note: Use make altinstallthe command instead of make installthe command to avoid overwriting the Python version that comes with the system.

  8. Once installed, you can check your Python version with the following command:

    python3.8 --version
    

    If Python 3.8.12the output is similar to , then Python 3.8 has been successfully installed on your Debian system.

Guess you like

Origin blog.csdn.net/gaoxiangfei/article/details/131242117