
Es ist einfach, Python 3.9 unter Debian zu kompilieren:
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev
wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
tar -xf Python-3.9.1.tgz
cd Python-3.9.1
./configure --enable-optimizations
#nproc value is 4 in my pc platform
make -j 4
sudo make altinstall
Wie kompiliere ich Python 3.9 und installiere es auf OpenWRT?
root@OpenWrt:~# cat /etc/banner
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt 19.07.7, r11306-c4a6851c72
-----------------------------------------------------
root@OpenWrt:~# uname -a
Linux OpenWrt 4.14.221 #0 SMP Mon Feb 15 15:22:37 2021 x86_64 GNU/Linux
root@OpenWrt:~# python3
Python 3.7.10 (default, May 28 2021, 13:26:31)
[GCC 7.5.0] on linux
Einige Software erfordert Python 3.8 oder höher, ich möchte Python 3.9 kompilieren.
Antwort1
Laden Sie das SDK für die gewünschte OpenWRT-Version herunter, ändern Sie das Makefile für Python und kompilieren Sie Python mit dem SDK.
Hier finden Sie einige Einrichtungsanweisungen:https://openwrt.org/docs/guide-developer/using_the_sdk
Sobald Sie das SDK installiert haben, ändern Sie die Makefiles für Python3 (hier ist ein Beispiel-PR, der integriert wurde, um Python auf 3.9.5 zu aktualisieren:https://github.com/openwrt/packages/pull/15586/commits/e312275dd9c25c4032b4d2d3623b042905c8bf16)
Anschließend sollten Sie das Paket mit einem Befehl wie kompilieren können , wodurch ein installierbares IPK im Ordner des SDK make package/python3/compile V=sc
entsteht .bin