📚 Termux Python 包安装教程

本系列教程教你如何在 Termux 上安装 Python 包,无需等待编译,直接使用预编译的 wheel 包。

⚡ 为什么要用预编译源?

❌ 不用预编译源(官方 PyPI)

$ pip install numpy
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting numpy
  Downloading numpy-2.4.4.tar.gz (20.7 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... error
error: subprocess-exited-with-error

× installing backend dependencies for numpy did not run successfully.
└─> Installing backend dependencies for ninja... error
    └─> Installing cmake... Installing setuptools-scm...
        ⚠️ 编译失败,折腾半小时还是装不上

结果:编译失败,浪费大量时间 ⏱️

✅ 使用预编译源(本仓库)

$ pip install --index-url https://nsyhykui.github.io/python_wheels_for_termux/simple/ numpy
Looking in indexes: https://nsyhykui.github.io/.../simple/
Collecting numpy
  Downloading numpy-2.4.4-cp313-cp313-android_24_arm64_v8a.whl (5.7 MB)
Installing collected packages: numpy
Successfully installed numpy-2.4.4

real    2m47.352s

结果:不到 3 分钟装好 ✅

⚡ 一键设为默认源(以后不用再敲 --index-url)
pip config set global.index-url https://nsyhykui.github.io/python_wheels_for_termux/simple/
设置后,直接 pip install 包名 即可。

📖 教程列表

💡 更多包
把命令里的包名替换即可,支持 800+ 预编译包。
查看完整列表:包索引

🔗 ← 返回包索引首页 | ⭐ GitHub 仓库