ARM安装python模块

ARM机器安装python模块绝对不不不不可以直接pip!!!

这里演示的是CentOS,其他linux系统类似。

Step1.安装必备

yum install epel-release
yum install blas-devel lapack-devel
yum install freetype-devel
yum install python-dev
# 安装完python-dev后在/usr/include/pythonX.X(版本号目录下应该有Python.h文件才对。

Step2. 下载模块的zip文件

这里以1.15.0的numpy模块为例。

pip download numpy==1.15.0

Step3. 解压zip

unzip numpy-1.15.0.zip
cd numpy-1.15.0

Step4. 安装

python setup.py install

 安装成功如下:

……
writing build/bdist.linux-aarch64/egg/EGG-INFO/native_libs.txt
creating dist
creating 'dist/numpy-1.15.0-py2.7-linux-aarch64.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing numpy-1.15.0-py2.7-linux-aarch64.egg
creating /usr/lib64/python2.7/site-packages/numpy-1.15.0-py2.7-linux-aarch64.egg
Extracting numpy-1.15.0-py2.7-linux-aarch64.egg to /usr/lib64/python2.7/site-packages
Adding numpy 1.15.0 to easy-install.pth file
Installing f2py script to /usr/bin
Installing conv-template script to /usr/bin
Installing from-template script to /usr/bin
Installing f2py script to /usr/bin

Installed /usr/lib64/python2.7/site-packages/numpy-1.15.0-py2.7-linux-aarch64.egg
Processing dependencies for numpy==1.15.0
Finished processing dependencies for numpy==1.15.0

注意:安装好后,要退出该模块所在路径,再启动python输入import测试,否则报错如下:

>>> import numpy as np
Traceback (most recent call last):
  File "", line 1, in 
  File "numpy/__init__.py", line 131, in 
    raise ImportError(msg)
ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.

 

你可能感兴趣的:(ARM安装python模块)