Debian服务器之安装Python3.7

1、系统环境介绍

1.1 系统版本

    debian-9.6.0-amd64-netinst

1.2 系统内核

    Linux lnnkee 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux

2、下载安装包

https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
3、配置安装环境

apt install libffi-dev #否则将会提示No module named‘_ctypes’
4、编译安装python

tar xvf Python-3.7.0.tar
cd Python-3.7.0
./configure --prefix=/usr/local/python3.7/ --enable-optimizations
make && make install
5、设置默认python

ln -s /usr/local/python3.7/bin/python3.7 /usr/bin/python

ln -s /usr/local/python3.7/bin/pip3.7 /usr/bin/pip
6、安装完成