Problems and Solutions of Alpine Installing Python3 Dependency
- 2021-08-31 08:34:54
- OfStack
apk switching
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
Build environment for installing Python
apk add --no-cache --virtual build-dependencies \
python3-dev \
libffi-dev \
openssl-dev \
gcc \
libc-dev \
make
Installing the Python dependency package
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 not installed
command 'gcc' failed with exit status 1
Later, it was found that an environment was missing
freetds-dev
After reinstallation, you can successfully install the dependencies
apk add freetds-dev
Note that after successful installation, if you uninstall the docker image size for the sake of docker image size,
freetds-dev
This environment package will cause an error when accessing the database
libsybdb.so.5: cannot open shared object file: No such file or directory
grpcio not installed
Like the above 1, it leaks the environment
build-base linux-headers
Execute
apk add build-base linux-headers
After that, you can successfully install
Pillow not installed
Like the above 1, it leaks the environment
jpeg-dev zlib-dev
Execute
ModuleNotFoundError: No module named 'Cython'
0
After that, you can successfully install
Finally, unload the dependency
apk del build-dependencies