apk换源

sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

安装Python的构建环境

apk add --no-cache --virtual build-dependencies \
python3-dev \
libffi-dev \
openssl-dev \
gcc \
libc-dev \
make

安装Python依赖包

ImportError: cannot import name 'Feature' from 'setuptools'

pip install --upgrade pip setuptools==45.2.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

ModuleNotFoundError: No module named 'Cython'

pip install cython -i https://pypi.tuna.tsinghua.edu.cn/simple

pymssql安装不上

command 'gcc' failed with exit status 1

后面发现是漏装了一个环境freetds-dev
重新安装之后,就能成功安装依赖了

apk add freetds-dev

注意的是,依赖成功安装之后,如果为了docker镜像大小,卸载了freetds-dev这个环境包,会导致访问数据库的时候报错libsybdb.so.5: cannot open shared object file: No such file or directory

grpcio安装不上

和上面一样,漏了环境build-base linux-headers

执行apk add build-base linux-headers之后,就能成功安装

Pillow安装不上

和上面一样,漏了环境jpeg-dev zlib-dev

执行apk add jpeg-dev zlib-dev之后,就能成功安装

最后卸载依赖

apk del build-dependencies
Logo

更多推荐