文档
注册

Python环境

前提条件

请参见表1完成环境准备。

表1 安装软件

名称

版本

说明

Python

Python3.7.5

安装方式与Python依赖版本的限制请参见CANN 软件安装指南

Python3.8.0 ~ Python3.8.10

Python3.9.2

Python依赖

-

Numpy

≥ 1.18.2

Python的一种开源的数值计算扩展。

使用pip3 install numpy安装Numpy。

Pillow

7.2.0

Python的图像处理库(Python Imaging Library)。

使用pip3 install Pillow命令安装Pillow。

本节所列的python、pip命令,实际命名与用户机器中软链接设置的命名一致,以对应python3.7.5版本为示例,请用户自行替换。

CentOS7 aarch64环境下安装Pillow的说明

CentOS7 aarch64环境中通过pip3.7 install Pillow安装Pillow之后,在执行from PIL import Image的时候会报错:

ImportError: /usr/local/python3.7.5/lib/python3.7/site-packages/PIL/_imaging.cpython-37m-aarch64-linux-gnu.so: ELF load command alignment not page-aligned

这种情况下,需要用源码安装Pillow。若已经通过pip安装,需要运行pip3.7 uninstall Pillow进行卸载。

  1. 链接中获取Pillow的源码压缩包,以Pillow-7.2.0.tar.gz为例。
  2. 检查下列Pillow的依赖是否安装,如果没有安装则进行安装。
    sudo yum install python-devel
    sudo yum install zlib-devel
    sudo yum install libjpeg-turbo-devel
  3. 解压Pillow源码压缩包并进行编译安装。
    tar -xvf Pillow-7.2.0.tar.gz
    cd Pillow-7.2.0/
    python3.7 setup.py build
    python3.7 setup.py install
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词