版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/xc_zhou/article/details/102507237
前期准备
1、安装好VM虚拟机,直接去官网下载就好。
2、下载Debian系统,直接去官网下载就好。
debain下载地址:https://cdimage.debian.org/cdimage/archive/
安装:

在Debian 9上安装Python 3并设置编程环境
Debian Linux预装了Python 3和Python 2。为了确保我们的版本是最新的更新,让我们使用apt命令更新和升级系统使其能够与Advanced Packaging Tool协同工作:
sudo apt update
sudo apt -y upgrade
复制
该
-y
标志将确认我们同意所有要安装的项目。
一旦完成该过程,我们可以通过键入以下内容来检查系统中安装的Python 3的版本:
python3 -V
复制
您将在终端窗口中收到输出,告知您版本号。虽然这个数字可能会有所不同,但输出结果与此类似:
Python 3.5.3
复制
要管理Python的软件包,让我们安装pip,这个工具将安装和管理我们可能想要在我们的开发项目中使用的编程包。
sudo apt install -y python3-pip
复制
还有一些软件包和开发工具可以安装,以确保我们为编程环境提供强大的设置:
sudo apt install build-essential libssl-dev libffi-dev python3-dev
复制
zlib库
sudo apt-get install zlib1g-dev
复制
OpenSSL库
sudo apt-get install openssl libssl-dev
复制
Ubuntu出现无法定位软件包,更换源
解决办法很简单,更换另一个源就行了。一般建议是使用国内的源。
1.在修改source.list前,最好先备份一份
执行备份命令
sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
复制
2.执行命令打开sources.list文件:
sudo vim /etc/apt/sources.list
复制
将下边的阿里源复制进去,然后点击保存关闭。
阿里源(ubuntu)
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
复制
阿里源(debian)
deb http://mirrors.aliyun.com/debian wheezy main contrib non-free
deb-src http://mirrors.aliyun.com/debian wheezy main contrib non-free
deb http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free
deb-src http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free
deb http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free
deb-src http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free
复制
更新源
sudo apt-get update
复制
更新软件
sudo apt-get upgrade
复制
清华源(ubuntu)
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
复制
网易源(ubuntu)
deb http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse
复制
debain 切换为root用户
输入su
输入root用户密码
查看系统版本
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.8 (wheezy)
Release: 7.8
Codename: wheezy
复制
安装参考链接:https://blog.csdn.net/whatday/article/details/86685072
https://jingyan.baidu.com/article/4d58d541791ffb9dd4e9c0e5.html
https://blog.csdn.net/u011303443/article/details/52119901
参考:https://cloud.tencent.com/developer/article/1360721
https://blog.csdn.net/Lxy_Python/article/details/81635302
https://www.cnblogs.com/tangyouwei/p/10109038.html
https://www.jianshu.com/p/d4ebc1d8a07d