在 Termux 上直接 pip install matplotlib 会触发漫长编译,这里教你绕过编译直接装。
pip install --index-url https://nsyhykui.github.io/python_wheels_for_termux/simple/ matplotlib
python -c "import matplotlib; print(matplotlib.__version__)"
Termux 默认没有显示器,用 Agg 后端保存图片即可:
python -c "
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
plt.savefig('plot.png')
print('saved to plot.png')
"
.so 后缀,用 pkg install 库名 安装即可。
🔗 ← 返回教程首页 | 📦 包索引(1100+ 包) | ⭐ GitHub