---
title: Python环境
description: "请参见表1完成环境准备。"
url: https://www.hiascend.com/document/detail/zh/Atlas200IDKA2DeveloperKit/latest/Application%20Development%20Guide/aadgp/aclpythondevg_02_0002.html
sourcePath: /source/zh/Atlas200IDKA2DeveloperKit/23.0.RC2/Application Development Guide/aadgp/aclpythondevg_02_0002.html
indexId: 59e192d86a58471915cf69e3e7a6d0fffd02f6aaffc968dae4e98186b472024f108
---
# Python环境

#### 前提条件

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


**表1 安装软件**

| 名称 | 版本 | 说明 |
| --- | --- | --- |
| Python | Python3.7.5 | 安装方式与Python依赖版本的限制请参见《CANN 软件安装指南(https://www.hiascend.com/document/detail/zh/canncommercial/700/envdeployment/instg/instg\_0001.html)》。 |
| Python | Python3.8.0 ~ Python3.8.10 | 安装方式与Python依赖版本的限制请参见《CANN 软件安装指南(https://www.hiascend.com/document/detail/zh/canncommercial/700/envdeployment/instg/instg\_0001.html)》。 |
| Python | Python3.9.2 | 安装方式与Python依赖版本的限制请参见《CANN 软件安装指南(https://www.hiascend.com/document/detail/zh/canncommercial/700/envdeployment/instg/instg\_0001.html)》。 |
| Python依赖 | \- | 安装方式与Python依赖版本的限制请参见《CANN 软件安装指南(https://www.hiascend.com/document/detail/zh/canncommercial/700/envdeployment/instg/instg\_0001.html)》。 |
| 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. 在链接(https://pypi.org/project/Pillow/#files)中获取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
```
