Commit f7596842 by 江名洋

build(docker): 从源码编译 numpy 并升级版本

1 parent ba377468
FROM python:3.11-slim FROM python:3.11-slim
# 兼容旧 CPU 的环境设置(OpenBLAS 使用兼容模式)
ENV OPENBLAS_CORETYPE=Haswell
# PyPI 镜像加速(清华源) # PyPI 镜像加速(清华源)
ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
WORKDIR /app WORKDIR /app
# 安装编译工具链(numpy 源码编译必需)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc g++ gfortran libopenblas-dev liblapack-dev \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt . COPY requirements.txt .
# numpy 1.24.4 使用 manylinux2014 wheel,兼容旧 x86-64 CPU # 从源码编译 numpy,限制 x86-64 基线指令(禁用 AVX/SSE4),兼容旧 CPU
RUN pip install --no-cache-dir numpy==1.24.4 RUN CFLAGS="-march=x86-64 -mtune=generic" \
pip install --no-cache-dir --no-binary=numpy numpy==1.26.4
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
RUN python -c "import numpy; print('numpy version:', numpy.__version__)" RUN python -c "import numpy; print('numpy version:', numpy.__version__)"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!