---
title: 源码编译构建
description: "获取NumPy源码，从源码构建wheel并安装本地构建产物。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengai/ecosystemEnable/numPy/kunpengnumpy_16_0005.html
sourcePath: /source/zh/kunpengai/ecosystemEnable/numPy/kunpengnumpy_16_0005.html
indexId: 42bdda08060c31201625e5c232b98fb34d03ea596b71d4c032d1da70f3641e2168
---
# 源码编译构建

获取NumPy源码，从源码构建wheel并安装本地构建产物。

1. 获取NumPy 2.4.4源码。
  1 2 3 mkdir -p /tmp/numpy-build/dist python3 -m pip download --no-build-isolation --no-binary=:all: --no-deps \ --dest /tmp/numpy-build numpy==2.4.4

  --no-binary=:all: 用于禁止下载预编译wheel，确保获取源码包并执行本地构建。

2. 从源码包构建wheel。
  1 2 python3 -m pip wheel --no-build-isolation --no-binary=:all: --no-deps \ --wheel-dir /tmp/numpy-build/dist /tmp/numpy-build/numpy-2.4.4.tar.gz

  构建产物示例。

  1 numpy-2.4.4-cp311-cp311-linux_aarch64.whl

3. 安装本地构建产物。
  1 python3 -m pip install --no-index --find-links /tmp/numpy-build/dist numpy==2.4.4
