Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
data_report
/
daw
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a452c0af
authored
Jun 26, 2026
by
江名洋
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix(docker): 修复旧CPU上NumPy非法指令崩溃
1 parent
f7596842
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
docker/Dockerfile
docker/Dockerfile
View file @
a452c0a
...
@@ -3,16 +3,19 @@ FROM python:3.11-slim
...
@@ -3,16 +3,19 @@ FROM python:3.11-slim
# PyPI 镜像加速(清华源)
# PyPI 镜像加速(清华源)
ENV
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
ENV
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
# 强制禁用 NumPy/OpenBLAS 使用 SSE2 以外的指令(此 CPU 仅有 SSE2)
ENV
OPENBLAS_CORETYPE=PRESCOTT
WORKDIR
/app
WORKDIR
/app
# 安装编译工具链
(numpy 源码编译必需)
# 安装编译工具链
RUN
apt-get update
&&
apt-get install -y --no-install-recommends
\
RUN
apt-get update
&&
apt-get install -y --no-install-recommends
\
gcc g++ gfortran libopenblas-dev liblapack-dev
\
gcc g++ gfortran libopenblas-dev liblapack-dev
\
&&
rm -rf /var/lib/apt/lists/
*
&&
rm -rf /var/lib/apt/lists/
*
COPY requirements.txt .
COPY requirements.txt .
# 从源码编译 numpy,
限制 x86-64 基线指令(禁用 AVX/SSE4),兼容旧 CPU
# 从源码编译 numpy,
禁用 SSE3/SSSE3/SSE4/AVX 等此 CPU 不支持的指令
RUN
CFLAGS
=
"-march=x86-64 -mtune=generic"
\
RUN
CFLAGS
=
"-march=x86-64 -mtune=generic
-mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-avx -mno-avx2
"
\
pip install --no-cache-dir --no-binary
=
numpy
numpy
==
1.26.4
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__)"
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment