NumPy是Python语言的一个扩充程序库。支持高级大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。Numpy内部解除了Python的GIL(全局解释器锁),运算效率极好,是大量机器学习框架的基础库
apt-get install clang python python-dev fftw
注:经测试fftw不用安装也可以成功
LDFLAGS="-lm -lcompiler_rt" pip install numpy
注:如果不使用LDFLAGS="-lm -lcompiler_rt"进行安装的话,numpy安装成功后import将会导致失败
Scipy库构建于NumPy之上,提供了一个用于在Python中进行科学计算的工具集,如数值计算的算法和一些功能函数,可以方便的处理数据。主要包含内容:统计,优化,整合,线性代数模块,傅里叶变换,信号和图像处理,常微分方程求解器等等
在使用 Termux 的时候发现无法正常安装 Python 的 Scipy 库,需要使用如下解决方案进行安装:
pkg install wget
wget https://its-pointless.github.io/setup-pointless-repo.sh
bash setup-pointless-repo.sh
pkg install scipy
python -c 'import scipy'
Jupyter Notebook是一个交互式笔记本,本质是一个 Web 应用程序,支持运行 40 多种编程语言。
apt install clang python python-dev fftw
LDFLAGS="-lm -lcompiler_rt" pip install numpy
pandas 是基于NumPy的一种工具,该工具是为了解决数据分析任务而创建的。Pandas 纳入了大量库和一些标准的数据模型,提供了高效地操作大型数据集所需的工具,使我们快速便捷地处理数据的函数和方法
LDFLAGS="-lm -lcompiler_rt" pip install pandas
Matplotlib是Python中最常用的可视化工具之一,可以非常方便地创建海量类型地2D图表和一些基本的3D图表
apt install libpng libpng-dev freetype freetype-dev pkg-config
LDFLAGS="-lm -lcompiler_rt" pip install matplotlib
apt install libzmq libzmq-dev
LDFLAGS="-lm -lcompiler_rt" pip install jupyter
jupyter notebook
运行后最下面一行是关键所在:http://localhost:8888/?token=longstringofcharacters 类似这样的
$ jupyter notebook
[I 04:20:42.886 NotebookApp] Writing notebook server cookie secret to /data/data/com.termux/files/home/.local/share/jupyter/runtime/notebook_cookie_secret
[I 04:20:43.167 NotebookApp] Serving notebooks from local directory: /data/data/com.termux/files/home
[I 04:20:43.167 NotebookApp] The Jupyter Notebook is running at:
[I 04:20:43.167 NotebookApp] http://localhost:8888/?token=3143924a0c165eaa3c17c0eced5659120f526b5a1503ab5e
[I 04:20:43.167 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 04:20:43.168 NotebookApp] No web browser found: could not locate runnable browser.
[C 04:20:43.168 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=3143924a0c165eaa3c17c0eced5659120f526b5a1503ab5e
将该URL复制到浏览器打开即可