OpenWRT安装Python

设备信息

  • ASUS RT-AC 1200GU (F/W Ver:V3.0.0.4.380_10732 H/W Ver:A)
  • openwrt-23.05.4-ramips-mt7621-asus_rt-ac57u-v1-initramfs-kernel.bin
  • openwrt-23.05.4-ramips-mt7621-asus_rt-ac57u-v1-squashfs-sysupgrade.bin

改国内源

vi /etc/opkg/distfeeds.conf

1
2
3
4
5
6
src/gz openwrt_core https://mirrors.aliyun.com/openwrt/releases/23.05.4/targets/x86/64/packages
src/gz openwrt_base https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/base
src/gz openwrt_luci https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/luci
src/gz openwrt_packages https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/packages
src/gz openwrt_routing https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/routing
src/gz openwrt_telephony https://mirrors.aliyun.com/openwrt/releases/23.05.4/packages/x86_64/telephony

环境安装

1
2
3
4
5
6
7
8
9
root@Openwrt:# opkg install python3-base

root@Openwrt:~# opkg install python3-pip

root@Openwrt:~# /usr/bin/python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip

root@Openwrt:~# opkg install requests

root@Openwrt:~# opkg install bs4

pip清华源

1
2
3
4
5
pip install pip -U

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U