• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Debian

Upgrade Python on Debian

How VPS by How VPS
November 1, 2019
in Debian
0
0
SHARES
20
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Obtain Python source code
  2. Compile Python
  3. Switch to the new version
  4. Differences for Python 3
  5. Want to contribute?


As you may know, Debian repositories update very slowly. At the time of writing, Python release versions are at 2.7.12 and 3.5.2, but in Debian 8 repositories you can find only 2.7.9 and 3.4.2. On Debian 7, versions in the repository are even older (2.7.3 and 3.2.3), both shipped in 2012.

This tutorial teaches you how to build Python from source and install the latest version. I assume you are using Debian 7 or 8. We will be obtaining the source code from the official Python FTP.

First, let’s check your currently installed version of Python. Run this command on your terminal:

python --version

You will see something like this:

Python 2.7.9

Commands below must be performed by the root user.

Obtain Python source code

The following commands will load an archive with Python sources for version 2.7.12 to the home directory, unpack it, and switch to the directory with unpacked files:

cd /home
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
tar xf Python-2.7.12.tar.xz
cd ./Python-2.7.12

Pay attention to the name of the folder with unpacked files. It will be the same as the archive name (without the archive extension).

Compile Python

Now we can build the updated Python binaries:

./configure
make
make install

Switch to the new version

If you check the Python version now, you still see the same old one. So we need to point the default Python interpreter path to the new python binary, which was installed to /usr/local/bin/python.

update-alternatives --install /usr/bin/python python /usr/local/bin/python 10

Now you will see the installed version:

python --version
Python 2.7.12

Differences for Python 3

Python 3 can be updated in the same fashion, with one simple difference – you need to specify python3 instead of python. Note that Python 3 doesn’t come pre-installed on Debian 7.

Check version:

python3 --version

Switch to new version:

update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3 10

When updating Python 3, remember to choose a corresponding archive from the Python FTP site.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

Connect Two Servers Using OpenVPN With Shared Secret

Next Post

How to Install TermRecord on Ubuntu 16.04 and Debian 9

Next Post

How to Install TermRecord on Ubuntu 16.04 and Debian 9

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet