需求:
構建 arm (linux_armv7l) 平臺上用於測試機器訓練的 python 鏡像,帶 numpy、 pandas、sklearn,等。
本文構建所用操作系統爲 ubuntu 16.04 64bit(4GB雙核),採用容器內安裝依賴庫的形式,非 Dockerfile,是因爲考慮到實際構建中可能會遇到各種問題。
技術總結
在 pc 端運行 arm 鏡像容器,使用arm32v7/python
,此方式是爲了方便製作(也可在 arm 系統上直接製作)。
鏡像標籤爲 slim,其爲 Debian 的 buster 版本。容器中無法補齊命令,無法查看以往命令,使用較爲麻煩。
安裝編譯相關工具和庫,因爲有些 python 庫要本地編譯(據查,是沒有該平臺的預編譯包)。
安裝 numpy 等庫。注意,由於官方沒有現成的包,需要在本地編譯,故會較耗時。
pip 安裝會順帶安裝相應依賴包。
寫程序驗證(本文略)。
國內源是爲了加快下載速度。編譯耗時取決於機器性能。
知識點
在 x86 上運行 arm 容器。
從頭開始編譯、安裝 python 庫。
從容器變成鏡像。
實驗步驟
運行容器
建立 pc 端運行 arm 容器環境:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
注:經測試發現,ubuntu 內核需在 4.8 以上。
運行基礎鏡像:
docker run -itd --name pythonslim arm32v7/python:3.7-slim sh
以下命令中,安裝、測試等在容器內進行。與 docker 有關的,在宿主機上進行。本文假定讀者能區別出來。
添加源
添加 debian 國內源,文件:
cat > /etc/apt/sources.list <<-EOF
deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
EOF
原始內容爲:
# deb http://snapshot.debian.org/archive/debian/20200414T000000Z buster main
deb http://deb.debian.org/debian buster main
# deb http://snapshot.debian.org/archive/debian-security/20200414T000000Z buster/updates main
deb http://security.debian.org/debian-security buster/updates main
# deb http://snapshot.debian.org/archive/debian/20200414T000000Z buster-updates main
deb http://deb.debian.org/debian buster-updates main
添加 pip 國內源:
mkdir ~/.pip/
cat > ~/.pip/pip.conf <<-EOF
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
EOF
注1:slim 版本沒有 vi 編輯器,故用此法。
注2:也可在 pip 安裝時用 -i
臨時指定源地址。
安裝編譯環境
apt-get install gcc g++ gfortran python-dev libopenblas-dev libblas-dev liblapack-dev cython -y
apt-get install libfreetype6-dev libpng-dev -y
apt-get install pkg-config -y # 注:需要此工具找freetype
apt-get install libfontconfig1-dev -y
安裝包
pip install numpy==1.18.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pandas==0.23.4 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install scipy==1.4.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install Cython -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install sklearn -i https://pypi.tuna.tsinghua.edu.cn/simple 注:依賴scipy Cython
pip install six -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install xlrd -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pyparsing -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install python-dateutil -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install matplotlib==3.2.1 -i https://pypi.tuna.tsinghua.edu.cn/simple # 注:要freetype,先不安裝
pip install pyhht -i https://pypi.tuna.tsinghua.edu.cn/simple # 注:需要 scipy、matplotlib
注1:可用pip list
查看安裝的庫及其版本。
注2:安裝(編譯) numpy、pandas、scipy、sklearn 等較耗時,每個包耗時數小時不等(因 slim 容器沒有 time 命令,無法知道具體耗時時間)。
查看安裝的包
本容器安裝的包:
# pip list
Package Version
--------------- ------------
cycler 0.10.0
Cython 0.29.16
freetype-py 2.1.0.post1
joblib 0.14.1
kiwisolver 1.2.0
matplotlib 3.2.1
numpy 1.18.1
pandas 0.23.4
pip 20.0.2
pyhht 0.1.0
pyparsing 2.4.7
python-dateutil 2.8.1
pytz 2019.3
scikit-learn 0.22.2.post1
scipy 1.4.1
setuptools 46.1.3
six 1.14.0
sklearn 0.0
wheel 0.34.2
xlrd 1.2.0
驗證
# python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import datasets,linear_model
如果沒有錯誤輸出,說明安裝成功。
製作鏡像
查看容器體積:
# du -h --max-depth=1
136M ./tmp
26M ./var
2.5M ./sbin
3.2M ./bin
220M ./root
1.5M ./etc
835M ./usr
7.1M ./lib
1.2G
將原始的容器保存爲鏡像:
docker commit pythonslim python-pandas-build:arm
這一步的目的是爲了保留編譯信息。方便後續製作。
清除不必要的文件:
apt-get autoremove python2 # bzip2 file會被刪除
apt-get autoremove gcc g++ gfortran # libgomp1 binutils binutils-arm-linux-gnueabihf 會被刪除
apt-get autoremove cython
apt-get autoremove perl
apt-get autoremove openssl
rm /usr/bin/perl /usr/bin/perl5.28.1
補回被刪除的包:
apt-get install libgomp1 # 注:sklearn依賴此包
apt-get install bzip2
清除緩存:
apt-get clean && rm -rf /var/lib/apt/lists/*
rm -rf /root/.cache
經分析,slim 版本的鏡像本身就超過 100 MB,加上 python 的幾個重要庫,經精簡後,體積仍近 600 MB。其中佔大頭的目錄是/usr/local/lib/python3.7/site-packages
。
將精簡後的容器保存爲鏡像:
docker commit pythonslim python-pandas:arm
打標籤,提交(到筆者的阿里雲倉庫):
docker tag python-pandas:arm registry.cn-hangzhou.aliyuncs.com/latelee/python-pandas:arm
docker push registry.cn-hangzhou.aliyuncs.com/latelee/python-pandas:arm
注:Docker 構建是分層的,不能在python-pandas-build:arm
鏡像中精簡,因爲此鏡像已超 1 GB,即使刪除文件,Docker 鏡像亦舉減少。因此,需要在pythonslim
中精簡。
運行:
docker run -itd --name pandas -v $PWD:/work registry.cn-hangzhou.aliyuncs.com/latelee/python-pandas:arm sh
問題及解決
安裝了 libfreetype6-dev 後,編譯 matplotlib 時還是提示 freetype 版本過低(即找不到庫),後添加 pkg-config ,可編譯通過。
使用
registry.cn-hangzhou.aliyuncs.com/latelee/python-pandas:arm
爲公開鏡像(僅在當前可訪問,後續不保證)。安裝軟件需要執行apt-get update
。
參考
scipy 鏡像構建參考:
https://github.com/publysher/docker-alpine-numpy
https://github.com/publysher/docker-alpine-scipy
https://github.com/publysher/docker-alpine-sklearn
https://github.com/amancevice/docker-pandas
scipy 安裝指導:
https://docs.scipy.org/doc/scipy-1.1.0/reference/building/linux.html
python 的 alpine 鏡像的問題:
https://pythonspeed.com/articles/alpine-docker-python/
scipy 在 alpine 上安裝問題:
https://github.com/scipy/scipy/issues/9481
https://github.com/scipy/scipy/issues/9338
附
slim鏡像出錯信息:
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp5_jvogwa
cwd: /tmp/pip-install-kyd6kagr/scipy
Complete output (137 lines):
lapack_opt_info:
lapack_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
openblas_lapack_info:
customize UnixCCompiler
customize UnixCCompiler
libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
openblas_clapack_info:
customize UnixCCompiler
customize UnixCCompiler
libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries tatlas,tatlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries tatlas,tatlas not found in /usr/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries tatlas,tatlas not found in /usr/lib/
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib/
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
customize UnixCCompiler
libraries satlas,satlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries satlas,satlas not found in /usr/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries satlas,satlas not found in /usr/lib/
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib/
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries ptf77blas,ptcblas,atlas not found in /usr/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries ptf77blas,ptcblas,atlas not found in /usr/lib/
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib/
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
customize UnixCCompiler
libraries f77blas,cblas,atlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries f77blas,cblas,atlas not found in /usr/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries f77blas,cblas,atlas not found in /usr/lib/
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib/
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
lapack_info:
customize UnixCCompiler
libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
NOT AVAILABLE
lapack_src_info:
NOT AVAILABLE
NOT AVAILABLE
setup.py:420: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /tmp/pip-modern-metadata-n429kcrr'), proceeding with generating Cython sources and expanding templates
' '.join(sys.argv[1:])))
Running from scipy source directory.
/tmp/pip-build-env-dwf79396/overlay/lib/python3.7/site-packages/numpy/distutils/system_info.py:624: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
self.calc_info()
/tmp/pip-build-env-dwf79396/overlay/lib/python3.7/site-packages/numpy/distutils/system_info.py:624: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
self.calc_info()
/tmp/pip-build-env-dwf79396/overlay/lib/python3.7/site-packages/numpy/distutils/system_info.py:624: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
self.calc_info()
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
main()
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 110, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-dwf79396/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 158, in prepare_metadata_for_build_wheel
self.run_setup()
File "/tmp/pip-build-env-dwf79396/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 250, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-dwf79396/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 143, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 540, in <module>
setup_package()
File "setup.py", line 536, in setup_package
setup(**metadata)
File "/tmp/pip-build-env-dwf79396/overlay/lib/python3.7/site-packages/numpy/distutils/core.py", line 135, in setup
config = configuration()
File "setup.py", line 435, in configuration
raise NotFoundError(msg)
numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp5_jvogwa Check the logs for full command output.
WARNING: You are using pip version 19.3.1; however, version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
原因:缺少編譯依賴的庫。
ModuleNotFoundError: No module named 'Cython'
raise ModuleNotFoundError(message)
ModuleNotFoundError: Please install Cython with a version >= 0.28.5 in order to build a scikit-learn from source.
原因:Cython 未安裝。
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
原因:網絡原因超時,重試。
src/checkdep_freetype2.c:3:6: error: #error "FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download it."
#error "FreeType version 2.3 or higher is required. \
^~~~~
src/checkdep_freetype2.c:10:10: error: #include expects "FILENAME" or <FILENAME>
#include FT_FREETYPE_H
^~~~~~~~~~~~~
src/checkdep_freetype2.c:15:9: note: #pragma message: Compiling with FreeType version FREETYPE_MAJOR.FREETYPE_MINOR.FREETYPE_PATCH.
#pragma message("Compiling with FreeType version " \
^~~~~~~
src/checkdep_freetype2.c:18:4: error: #error "FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download it."
#error "FreeType version 2.3 or higher is required. \
^~~~~
error: command 'gcc' failed with exit status 1
原因:安裝 freetype。
alpine鏡像:
libraries lapack_atlas not found in /usr/local/lib
libraries tatlas,tatlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries tatlas,tatlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
libraries lapack_atlas not found in /usr/local/lib
libraries satlas,satlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries satlas,satlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in /usr/local/lib
libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries ptf77blas,ptcblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
libraries lapack_atlas not found in /usr/local/lib
libraries f77blas,cblas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries f77blas,cblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
lapack_info:
libraries lapack not found in ['/usr/local/lib', '/usr/lib']
NOT AVAILABLE
lapack_src_info:
NOT AVAILABLE
NOT AVAILABLE
running dist_info
running build_src
build_src
building py_modules sources
creating build
creating build/src.linux-armv7l-3.5
creating build/src.linux-armv7l-3.5/numpy
creating build/src.linux-armv7l-3.5/numpy/distutils
building library "npymath" sources
Could not locate executable gfortran
Could not locate executable f95
Could not locate executable ifort
Could not locate executable ifc
Could not locate executable lf95
Could not locate executable pgfortran
Could not locate executable f90
Could not locate executable f77
Could not locate executable fort
Could not locate executable efort
Could not locate executable efc
Could not locate executable g77
Could not locate executable g95
Could not locate executable pathf95
Could not locate executable nagfor
don't know how to compile Fortran code on platform 'posix'
Running from numpy source directory.
setup.py:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/system_info.py:1896: UserWarning:
Optimized (vendor) Blas libraries are not found.
Falls back to netlib Blas library which has worse performance.
A better performance should be easily gained by switching
Blas library.
if self._calc_info(blas):
/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/system_info.py:1896: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
if self._calc_info(blas):
/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/system_info.py:1896: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
if self._calc_info(blas):
/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/system_info.py:1730: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
return getattr(self, '_calc_info_{}'.format(name))()
/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/system_info.py:1730: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
return getattr(self, '_calc_info_{}'.format(name))()
/usr/local/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
main()
File "/usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py", line 110, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-35qyjrc3/overlay/lib/python3.5/site-packages/setuptools/build_meta.py", line 158, in prepare_metadata_for_build_wheel
self.run_setup()
File "/tmp/pip-build-env-35qyjrc3/overlay/lib/python3.5/site-packages/setuptools/build_meta.py", line 250, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-35qyjrc3/overlay/lib/python3.5/site-packages/setuptools/build_meta.py", line 143, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 488, in <module>
setup_package()
File "setup.py", line 480, in setup_package
setup(**metadata)
File "/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/core.py", line 171, in setup
return old_setup(**new_attr)
File "/tmp/pip-build-env-35qyjrc3/overlay/lib/python3.5/site-packages/setuptools/__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-35qyjrc3/overlay/lib/python3.5/site-packages/setuptools/command/dist_info.py", line 31, in run
egg_info.run()
File "/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/command/egg_info.py", line 26, in run
self.run_command("build_src")
File "/usr/local/lib/python3.5/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/command/build_src.py", line 146, in run
self.build_sources()
File "/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/command/build_src.py", line 157, in build_sources
self.build_library_sources(*libname_info)
File "/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/command/build_src.py", line 290, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "/tmp/pip-install-lpg1hl36/numpy/numpy/distutils/command/build_src.py", line 380, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 661, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpxxww43e_ Check the logs for full command output.
The command '/bin/sh -c pip install $(grep numpy requirements.txt) && pip install -r requirements.txt' returned a non-zero code: 1
原因:缺少庫,同 slim 版本,本文不採用。