返回文章列表文章索引阅读全文
STARBLOG / 阅读手记
系统配置

Debian8-stable - Upgrade Python version to 3.6

Foreword I recently deployed a Python project to a server, but the Python version on the server was far too outdated, so I set about updating it. The methods I found online all involved downloading the Python 3.6 source code and manually compiling it. However, I encountered some issues while compiling and installing on the server, which led me to consider using Ubuntu’s PPA method. Since Debian and Ubuntu share common origins, Ubuntu’s PPA should theoretically work on Debian as well. The steps are as follows: Add the software source add-apt-reposito

曦远 (DealiAxy)约 5 分钟
目录7 个章节

Preface

Recently, I deployed a Python project to a server, but the Python version on the server was quite outdated, so I proceeded to update it.

The methods I found online all involved downloading the Python 3.6 source code and compiling it manually. However, I encountered some issues while compiling and installing it on the server. That's when I thought of using Ubuntu's PPA method. Since Debian and Ubuntu share the same origins, in theory, Ubuntu's PPAs should also work on Debian.

The operation steps are as follows:

Adding Software Repository

add-apt-repository ppa:deadsnakes/ppa

However, Debian does not have add-apt-repository, so you need to install it first.

apt-get install software-properties-common

After installing this, you can use the command above to add the PPA source.

Don't rush at this point, because PPAs are originally for Ubuntu, and using them on Debian always requires a few small modifications.

Open the PPA website: https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6

Select the Ubuntu version 14.04.

Copy these two lines of code.

Then open the directory for software sources:

cd /etc/apt/sources.list.d

You can see there is a file inside:

-rw-r--r-- 1 root root 290 Jun 19 00:26 jonathonf-python-3_6-jessie.list

Edit it:

deb http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu jessie main

deb-src http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu jessie main


Replace the original content with the content just copied, then save.

Update Software Sources & Installation

apt update
apt install python3.6

Install the corresponding version of pip

su
curl https://bootstrap.pypa.io/get-pip.py | python3.6
(pip -V && pip3 -V && pip3.6 -V) | uniq

Check Version

python3.6 -m pip -V
cd /usr/bin
rm python3
ln -s python3.6 python3

And that's it!

_EOF_

Debian8-stable - Upgrade Python version to 3.6

本文作者:
程序设计实验室
版权声明:
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

相关文章

Nginx配置http跳转https-强制https访问

前言 最近上线了好几个项目,同时也申请了相应的SSL证书,不过发现了一个问题,用户在浏览器直接输入域名的时候,浏览器默认访问的是http站点,然而我们的网站只支持https访问,所以就访问不了咯。 其实可以在nginx全局配置里面把所有访问重定向到https,不过服务器有些站点是提供http服务的,所以只能每个站点分别配置。 根据搜索引擎找到的资料,本文总结了三种配置方法,有需要的朋友可以选择中意

2025-10-27 · 系统配置 · 约 1 分钟

讨论

共 0 条

良言一句三冬暖,恶语伤人六月寒。

加载评论中…

Debian8-stable - Upgrade Python version to 3.6 · StarBlog