树莓派安装Python3.7

1. 安装依赖

sudo apt-get update -y
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev -y

注意: 如果提示安装包未找到,尝试最新的版本(如:将libdb5.3-dev 改为 libdb5.4-dev)

2. 编译安装

下载最新版python安装包,官网地址:https://www.python.org/downloads/source/

wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tar.xz
tar xf Python-3.7.4.tar.xz
cd Python-3.7.4
./configure
make -j 4
sudo make altinstall

转载地址

2019-12-08 13:52:59