资讯动态

TensorFlow 从源码构建完全指南:在 Linux 与 macOS 上编译安装自定义 pip 包

发布时间:2026/10/9 10:12:51 来源:尧图企业网站定制
文档开发工具教程【免费下载链接】docsTensorFlow documentation项目地址https://gitcode.com/gh_mirrors/doc/docs点击查看免费下载本篇指南以 TensorFlow 官方文档《Build from source》位于仓库 site/en/install/source.md为主体系统讲解在Ubuntu Linux 与 macOS上从源码编译 TensorFlow并生成、安装自定义 pip 包.whl的完整流程。读完本文你将掌握开发环境的搭建Python、Bazel/Bazelisk、Clang、./configure构建配置的每一个交互选项与含义、CPU/GPU/TPU/夜间版四种 wheel 的构建命令以及借助官方 Docker 开发镜像在容器内构建 Linux 包的捷径与验证方法。文中还附带了官方完整测试构建配置表供选择编译器与 Bazel 版本时对照参考。适用前提本文描述的流程仅在Ubuntu 与 macOS上经过官方测试与支持其他系统如其它 Linux 发行版理论上可参考但不在官方保障范围内。若你只是想快速使用 TensorFlow官方已提供经过充分测试的预编译 pip 包安装指南Linux 与 macOS 均有现成 wheel无需从源码编译。需要自定义 CPU 指令集优化、特定 CUDA 架构PTX/Compute Capability或非官方版本组合时才需要走源码构建路线。1. 为什么需要从源码构建绝大多数用户直接使用pip install tensorflow即可但以下场景必须或强烈建议从源码构建GPU 架构不在官方 wheel 的 PTX 覆盖范围内预编译包只包含最新受支持 CUDA 架构的 PTX 代码较老的 GPU 会出现Status: device kernel image is invalid错误此时需要按自己的 Compute Capability 重新编译详见 pip 安装指南 的硬件要求小节。需要针对本机 CPU 深度优化默认优化标志-marchnative会为编译机 CPU 生成专有指令集代码。需要自定义组合如不同的 CUDA/cuDNN 版本、启用或禁用特定--configMKL、NUMA、monolithic 等。开发/调试 TensorFlow 本身需要带调试信息的构建--configdbg。仓库的安装导航页 site/en/install/_toc.yaml 将“Build from source”分为 Linux/macOS本指南对应的 source.md与 Windowssource_windows.md两条独立路线本文聚焦前者。2. 环境准备安装构建工具链2.1 Python 与 pip 包依赖Ubuntu安装 Python 开发头文件与 pipsudo apt install python3-dev python3-pipmacOS要求 Xcode 9.2 或更高版本使用 Homebrew 安装 Pythonbrew install python随后升级 pip并安装 TensorFlow pip 包的构建依赖若使用虚拟环境请去掉--user参数pip install -U --user pip版本硬性要求安装 TensorFlow 2 的.whl包要求 pip 版本 19.0。完整的REQUIRED_PACKAGES依赖列表定义在 TensorFlow 仓库的tensorflow/tools/pip_package/setup.py.tpl文件中——该文件是生成最终setup.py的模板构建 wheel 时 Bazel 会依据它注入install_requires依赖。Windows 侧的对应文档 source_windows.md 展示了同一模板派生出的运行时依赖six、numpy、wheel、packaging、keras_preprocessing等可作为 Linux/macOS 依赖清单的参照。2.2 BazelTensorFlow 的构建系统TensorFlow 使用 Bazel 构建且对 Bazel 版本有严格要求各版本对应的 Bazel 版本见第 7 节测试配置表。推荐通过Bazelisk安装——它会读取仓库根目录的.bazelversion文件自动下载并切换到正确版本的 Bazel只需把 Bazelisk 以bazel命名加入PATH# 将 bazelisk 下载/安装后软链或重命名为 PATH 中的 bazel 可执行文件若 Bazelisk 不可用也可手动安装 Bazel但必须以 TensorFlow 仓库.bazelversion文件中声明的版本为准否则可能出现兼容性错误。2.3 Clang 编译器Linux 推荐从 TensorFlow 2.13 开始Clang基于 LLVM 的 C/C/Objective-C 编译器成为构建 TensorFlow 的默认编译器当前官方支持的版本为LLVM/Clang 17。两种安装方式方式 A通过 LLVM 官方 Debian/Ubuntu nightly 软件源手动添加 llvm apt 源后务必先执行 updatesudo apt-get update sudo apt-get install -y llvm-17 clang-17安装后 clang 的实际路径为/usr/lib/llvm-17/bin/clang。方式 B下载并解压预编译的 Clang LLVM 17 二进制适合 Debian/Ubuntucd desired directory wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.2/clangllvm-17.0.2-x86_64-linux-gnu-ubuntu-22.04.tar.xz tar -xvf clangllvm-17.0.2-x86_64-linux-gnu-ubuntu-22.04.tar.xz cp -r clangllvm-17.0.2-x86_64-linux-gnu-ubuntu-22.04/* /usr # 可能需要 sudo若已有旧安装请覆盖替换 clang --version # 校验版本此时/usr/bin/clang即新 clang 的路径。之后可通过运行./configure交互配置或手动设置环境变量CC与BAZEL_COMPILER指向该路径。2.4 GPU 支持可选仅 LinuxmacOS没有官方 GPU 支持。若要在 Linux 上启用 GPU请先阅读 pip 安装指南 中的 GPU 支持章节安装 NVIDIA 驱动及配套软件。更省事的方式是直接使用官方 GPU 版 Docker 开发镜像见第 6 节宿主机器只需 NVIDIA 驱动连 CUDA Toolkit 都不必安装。2.5 下载 TensorFlow 源码git clone https://github.com/tensorflow/tensorflow.git cd tensorflow仓库默认位于master开发分支。若要构建某个发布版本可检出对应 release 分支git checkout branch_name # 例如 r2.2、r2.3 等3. 配置构建./configure全解析TensorFlow 的构建配置由仓库根目录的.bazelrc文件承载./configure及其 Python 版本./configure.py脚本用于交互式调整常用设置。请从仓库根目录运行./configure两个脚本的差异在于路径优先级./configure.py在虚拟环境中会优先采用虚拟环境内的 Python 路径而./configure优先采用环境外的路径两者均可在交互中手动更改默认值。3.1 典型配置会话实录Sample session一次完整的./configure运行示例如下实际会话因环境而异./configure You have bazel 6.1.0 installed. Please specify the location of python. [Default is /Library/Frameworks/Python.framework/Versions/3.9/bin/python3]: Found possible Python library paths: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages Please input the desired Python library path to use. Default is [...]: Do you wish to build TensorFlow with ROCm support? [y/N]: No ROCm support will be enabled for TensorFlow. Do you wish to build TensorFlow with CUDA support? [y/N]: No CUDA support will be enabled for TensorFlow. Do you want to use Clang to build TensorFlow? [Y/n]: Clang will be used to compile TensorFlow. Please specify the path to clang executable. [Default is /usr/lib/llvm-16/bin/clang]: You have Clang 16.0.4 installed. Please specify optimization flags to use during compilation when bazel option --configopt is specified [Default is -Wno-sign-compare]: Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n Not configuring the WORKSPACE for Android builds. Do you wish to build TensorFlow with iOS support? [y/N]: n No iOS support will be enabled for TensorFlow. Preconfigured Bazel build configs. You can use any of the below by adding --config to your build command. See .bazelrc for more details. --configmkl # Build with MKL support. --configmkl_aarch64 # Build with oneDNN and Compute Library for the Arm Architecture (ACL). --configmonolithic # Config for mostly static monolithic build. --confignuma # Build with NUMA support. --configdynamic_kernels # (Experimental) Build kernels into separate shared objects. --configv1 # Build with TensorFlow 1 API instead of TF 2 API. Preconfigured Bazel build configs to DISABLE default on features: --confignogcp # Disable GCP support. --confignonccl # Disable NVIDIA NCCL support.该会话展示了配置脚本的核心询问项Python 解释器路径、Python 库路径、ROCm/CUDA 支持、是否用 Clang 及 clang 路径、--configopt时的优化标志、Android/iOS 支持等。回答完成后脚本会列出.bazelrc中预置的可选--config。3.2 关键配置选项详解GPU 支持分版本差异TensorFlow ≥ 2.18.0配置时设cudaY并按需指定 CUDA 与 cuDNN 版本。Bazel 会自动下载CUDA 和 cuDNN 包也可指向本地文件系统中的 CUDA/CUDNN/NCCL 发行版。从 2.18.0 起甚至可以在没有 GPU 与 NVIDIA 驱动的机器上构建 GPU wheel见第 6.2 节。TensorFlow 2.18.0设cudaY后需显式指定 CUDA 与 cuDNN 版本若系统装有多个版本务必显式设置而非依赖默认值。注意./configure会为系统 CUDA 库创建符号链接——一旦更新了 CUDA 库路径必须重新运行配置步骤再构建。优化标志编译优化标志的默认值-marchnative会针对编译机的 CPU 类型生成专有指令。若目标运行机器与编译机 CPU 不同例如为发布而交叉构建应改用更具体的优化标志可参考 GCC 手册中i386/x86-64选项一节。预置构建配置Preconfigured configurations以下常用--config可直接追加到bazel build命令后配置作用--configdbg携带调试信息构建详见仓库 CONTRIBUTING 文档--configmkl启用 Intel MKL-DNN 支持--configmonolithic构建一个基本静态的 monolithic 单体包--confignuma启用 NUMA 支持--configmkl_aarch64使用 oneDNN 与 Arm 架构计算库ACL构建--configdynamic_kernels实验性将内核构建为独立共享对象--configv1构建 TensorFlow 1 API 而非 TF 2 API--confignogcp/--confignonccl分别禁用 GCP 支持与 NVIDIA NCCL 支持4. 构建并安装 pip 包4.1 Bazel 构建选项与内存控制完整的 Bazel 构建选项请查阅 Bazel 官方命令行参考。从源码构建 TensorFlow 非常耗内存若系统内存紧张用以下参数限制 Bazel 的 RAM 用量--local_ram_resources2048官方发布的 TensorFlow 包使用符合manylinux2014打包标准的 Clang 工具链构建若希望与官方行为一致构建时应选用 Clang 而非 GCC。4.2 构建 wheelWHEEL_NAME决定包类型构建 pip 包必须指定--repo_envWHEEL_NAME标志该环境变量决定生成的包名与内容。--repo_envUSE_PYWRAP_RULES1用于启用 Python wrapper 构建规则。四种典型场景CPU 包bazel build //tensorflow/tools/pip_package:wheel --repo_envUSE_PYWRAP_RULES1 --repo_envWHEEL_NAMEtensorflow_cpuGPU 包bazel build //tensorflow/tools/pip_package:wheel --repo_envUSE_PYWRAP_RULES1 --repo_envWHEEL_NAMEtensorflow --configcuda --configcuda_wheelTPU 包bazel build //tensorflow/tools/pip_package:wheel --repo_envUSE_PYWRAP_RULES1 --repo_envWHEEL_NAMEtensorflow_tpu --configtpu夜间版nightly包将tensorflow替换为tf_nightly即可例如构建 CPU 夜间版bazel build //tensorflow/tools/pip_package:wheel --repo_envUSE_PYWRAP_RULES1 --repo_envWHEEL_NAMEtf_nightly_cpu构建完成后生成的 wheel 位于bazel-bin/tensorflow/tools/pip_package/wheel_house/4.3 安装生成的 wheelwheel 文件名由 TensorFlow 版本与目标平台决定用 pip 直接安装pip install bazel-bin/tensorflow/tools/pip_package/wheel_house/tensorflow-version-tags.whl安装成功即完成 TensorFlow 的自定义部署。小贴士导入 TensorFlow 时若报错 “Unless you are using bazel, you should not try to import tensorflow from its source directory”说明你正从源码目录直接 import请先退出源码树再启动 Python 解释器参见 常见构建与安装错误。5. 常见构建错误速查仓库中的 site/en/install/errors.md 汇总了官方跟踪的构建/安装错误及对应讨论以下三类在源码构建中最常遇到错误信息含义与处理No matching distribution found for tensorflowpip 找不到与系统/Python 版本匹配的包先核对系统要求与 Python 版本ImportError: libcudart.so.Version: cannot open shared object fileCUDA 运行库缺失或路径未配置检查LD_LIBRARY_PATH与 CUDA 安装ImportError: libcudnn.Version: cannot open shared object filecuDNN 库缺失或版本不匹配核对第 7 节测试表中的 cuDNN 版本从源码目录直接 import 报错退出源码树后再启动 Python 解释器6. Docker Linux 构建免污染宿主机的最优路径TensorFlow 官方 Docker 开发镜像已内置源码与全部构建依赖是搭建 Linux 源码构建环境的捷径。镜像标签与安装说明见 Docker 指南。6.1 CPU-only 容器构建拉取最新开发镜像并启动容器在/tensorflow_src源码根目录启动 shell将宿主机当前目录挂载到容器/mnt并通过HOST_PERMS环境变量传入宿主用户信息以处理 Docker 权限问题docker pull tensorflow/tensorflow:devel docker run -it -w /tensorflow_src -v $PWD:/mnt -e HOST_PERMS$(id -u):$(id -g) \ tensorflow/tensorflow:devel bash git pull # 容器内拉取最新源码若想构建宿主机的源码副本则把宿主机源码树挂载到容器/tensorflow目录docker run -it -w /tensorflow -v /path/to/tensorflow:/tensorflow -v $PWD:/mnt \ -e HOST_PERMS$(id -u):$(id -g) tensorflow/tensorflow:devel bash源码就绪后在容器内按“可选配置 → 构建 → 调整属主权限”三步走./configure # 如需要才执行 bazel build //tensorflow/tools/pip_package:wheel \ --repo_envUSE_PYWRAP_RULES1 --repo_envWHEEL_NAMEtensorflow_cpu --configopt chown $HOST_PERMS bazel-bin/tensorflow/tools/pip_package/wheel_house/tensorflow-version-tags.whl在容器内安装并验证pip uninstall tensorflow # 先移除现有版本 pip install bazel-bin/tensorflow/tools/pip_package/wheel_house/tensorflow-version-tags.whl cd /tmp # 不要从源码目录 import python -c import tensorflow as tf; print(tf.__version__)构建完成的 wheel 会以宿主用户权限出现在宿主机的当前目录./tensorflow-version-tags.whl。6.2 GPU 容器构建Docker 是构建 TensorFlow GPU 支持的最简方式宿主机器只需 NVIDIA 驱动无需安装 CUDA Toolkit。先按 pip 安装指南 与 Docker 指南 配置 nvidia-docker仅 Linux。从TensorFlow 2.18.0起甚至可在无 GPU、无 NVIDIA 驱动的机器上构建 GPU wheel。拉取 GPU 开发镜像并启动 GPU 容器docker pull tensorflow/tensorflow:devel-gpu docker run --gpus all -it -w /tensorflow -v $PWD:/mnt -e HOST_PERMS$(id -u):$(id -g) \ tensorflow/tensorflow:devel-gpu bash git pull # 容器内拉取最新源码容器内构建 GPU 包./configure # 如需要才执行 bazel build //tensorflow/tools/pip_package:wheel \ --repo_envUSE_PYWRAP_RULES1 --repo_envWHEEL_NAMEtensorflow --configcuda \ --configcuda_wheel --configopt chown $HOST_PERMS bazel-bin/tensorflow/tools/pip_package/wheel_house/tensorflow-version-tags.whl安装并验证 GPU 可用性pip uninstall tensorflow # 先移除现有版本 pip install bazel-bin/tensorflow/tools/pip_package/wheel_house/tensorflow-version-tags.whl cd /tmp # 不要从源码目录 import python -c import tensorflow as tf; print(\Num GPUs Available: \, len(tf.config.list_physical_devices(GPU)))关于 Docker 镜像 tag 体系latest/nightly/版本号以及-gpu/-jupyter变体的完整说明参见 site/en/install/docker.md。7. 官方测试构建配置Tested build configurations下表为官方在相应版本上实际测试过的 Python、编译器、构建工具及 CUDA/cuDNN 组合。选择 Bazel 版本与编译器时请严格对照此表这是本仓库文档中唯一经过验证的版本组合证据。仓库内的版本更新脚本 tools/release_tools/update_versions.py 会在新版本发布时自动向这些表格source.md与source_windows.md被列入其EXPAND_TABLES追加新行因此下表会随 TensorFlow 迭代持续演进。7.1 Linux CPU版本Python 版本编译器构建工具tensorflow-2.21.03.10-3.13Clang 18.1.8Bazel 7.4.1tensorflow-2.20.03.9-3.13Clang 18.1.8Bazel 7.4.1tensorflow-2.19.03.9-3.12Clang 18.1.8Bazel 6.5.0tensorflow-2.18.03.9-3.12Clang 17.0.6Bazel 6.5.0tensorflow-2.17.03.9-3.12Clang 17.0.6Bazel 6.5.0tensorflow-2.16.13.9-3.12Clang 17.0.6Bazel 6.5.0tensorflow-2.15.03.9-3.11Clang 16.0.0Bazel 6.1.0tensorflow-2.14.03.9-3.11Clang 16.0.0Bazel 6.1.0tensorflow-2.13.03.8-3.11Clang 16.0.0Bazel 5.3.0tensorflow-2.12.03.8-3.11GCC 9.3.1Bazel 5.3.0tensorflow-2.11.03.7-3.10GCC 9.3.1Bazel 5.3.0tensorflow-2.10.03.7-3.10GCC 9.3.1Bazel 5.1.1tensorflow-2.9.03.7-3.10GCC 9.3.1Bazel 5.0.0tensorflow-2.8.03.7-3.10GCC 7.3.1Bazel 4.2.1tensorflow-2.7.03.7-3.9GCC 7.3.1Bazel 3.7.2tensorflow-2.6.03.6-3.9GCC 7.3.1Bazel 3.7.2tensorflow-2.5.03.6-3.9GCC 7.3.1Bazel 3.7.2tensorflow-2.4.03.6-3.8GCC 7.3.1Bazel 3.1.0tensorflow-2.3.03.5-3.8GCC 7.3.1Bazel 3.1.0tensorflow-2.2.03.5-3.8GCC 7.3.1Bazel 2.0.0tensorflow-2.1.02.7, 3.5-3.7GCC 7.3.1Bazel 0.27.1tensorflow-2.0.02.7, 3.3-3.7GCC 7.3.1Bazel 0.26.1tensorflow-1.15.02.7, 3.3-3.7GCC 7.3.1Bazel 0.26.1tensorflow-1.14.02.7, 3.3-3.7GCC 4.8Bazel 0.24.1tensorflow-1.13.12.7, 3.3-3.7GCC 4.8Bazel 0.19.2tensorflow-1.12.02.7, 3.3-3.6GCC 4.8Bazel 0.15.0tensorflow-1.11.02.7, 3.3-3.6GCC 4.8Bazel 0.15.0tensorflow-1.10.02.7, 3.3-3.6GCC 4.8Bazel 0.15.0tensorflow-1.9.02.7, 3.3-3.6GCC 4.8Bazel 0.11.0tensorflow-1.8.02.7, 3.3-3.6GCC 4.8Bazel 0.10.0tensorflow-1.7.02.7, 3.3-3.6GCC 4.8Bazel 0.10.0tensorflow-1.6.02.7, 3.3-3.6GCC 4.8Bazel 0.9.0tensorflow-1.5.02.7, 3.3-3.6GCC 4.8Bazel 0.8.0tensorflow-1.4.02.7, 3.3-3.6GCC 4.8Bazel 0.5.4tensorflow-1.3.02.7, 3.3-3.6GCC 4.8Bazel 0.4.5tensorflow-1.2.02.7, 3.3-3.6GCC 4.8Bazel 0.4.5tensorflow-1.1.02.7, 3.3-3.6GCC 4.8Bazel 0.4.2tensorflow-1.0.02.7, 3.3-3.6GCC 4.8Bazel 0.4.27.2 Linux GPU版本Python 版本编译器构建工具cuDNNCUDAtensorflow-2.21.03.10-3.13Clang 18.1.8Bazel 7.4.19.312.5tensorflow-2.20.03.9-3.13Clang 18.1.8Bazel 7.4.19.312.5tensorflow-2.19.03.9-3.12Clang 18.1.8Bazel 6.5.09.312.5tensorflow-2.18.03.9-3.12Clang 17.0.6Bazel 6.5.09.312.5tensorflow-2.17.03.9-3.12Clang 17.0.6Bazel 6.5.08.912.3tensorflow-2.16.13.9-3.12Clang 17.0.6Bazel 6.5.08.912.3tensorflow-2.15.03.9-3.11Clang 16.0.0Bazel 6.1.08.912.2tensorflow-2.14.03.9-3.11Clang 16.0.0Bazel 6.1.08.711.8tensorflow-2.13.03.8-3.11Clang 16.0.0Bazel 5.3.08.611.8tensorflow-2.12.03.8-3.11GCC 9.3.1Bazel 5.3.08.611.8tensorflow-2.11.03.7-3.10GCC 9.3.1Bazel 5.3.08.111.2tensorflow-2.10.03.7-3.10GCC 9.3.1Bazel 5.1.18.111.2tensorflow-2.9.03.7-3.10GCC 9.3.1Bazel 5.0.08.111.2tensorflow-2.8.03.7-3.10GCC 7.3.1Bazel 4.2.18.111.2tensorflow-2.7.03.7-3.9GCC 7.3.1Bazel 3.7.28.111.2tensorflow-2.6.03.6-3.9GCC 7.3.1Bazel 3.7.28.111.2tensorflow-2.5.03.6-3.9GCC 7.3.1Bazel 3.7.28.111.2tensorflow-2.4.03.6-3.8GCC 7.3.1Bazel 3.1.08.011.0tensorflow-2.3.03.5-3.8GCC 7.3.1Bazel 3.1.07.610.1tensorflow-2.2.03.5-3.8GCC 7.3.1Bazel 2.0.07.610.1tensorflow-2.1.02.7, 3.5-3.7GCC 7.3.1Bazel 0.27.17.610.1tensorflow-2.0.02.7, 3.3-3.7GCC 7.3.1Bazel 0.26.17.410.0tensorflow_gpu-1.15.02.7, 3.3-3.7GCC 7.3.1Bazel 0.26.17.410.0tensorflow_gpu-1.14.02.7, 3.3-3.7GCC 4.8Bazel 0.24.17.410.0tensorflow_gpu-1.13.12.7, 3.3-3.7GCC 4.8Bazel 0.19.27.410.0tensorflow_gpu-1.12.02.7, 3.3-3.6GCC 4.8Bazel 0.15.079tensorflow_gpu-1.11.02.7, 3.3-3.6GCC 4.8Bazel 0.15.079tensorflow_gpu-1.10.02.7, 3.3-3.6GCC 4.8Bazel 0.15.079tensorflow_gpu-1.9.02.7, 3.3-3.6GCC 4.8Bazel 0.11.079tensorflow_gpu-1.8.02.7, 3.3-3.6GCC 4.8Bazel 0.10.079tensorflow_gpu-1.7.02.7, 3.3-3.6GCC 4.8Bazel 0.9.079tensorflow_gpu-1.6.02.7, 3.3-3.6GCC 4.8Bazel 0.9.079tensorflow_gpu-1.5.02.7, 3.3-3.6GCC 4.8Bazel 0.8.079tensorflow_gpu-1.4.02.7, 3.3-3.6GCC 4.8Bazel 0.5.468tensorflow_gpu-1.3.02.7, 3.3-3.6GCC 4.8Bazel 0.4.568tensorflow_gpu-1.2.02.7, 3.3-3.6GCC 4.8Bazel 0.4.55.18tensorflow_gpu-1.1.02.7, 3.3-3.6GCC 4.8Bazel 0.4.25.18tensorflow_gpu-1.0.02.7, 3.3-3.6GCC 4.8Bazel 0.4.25.187.3 macOS CPU版本Python 版本编译器构建工具tensorflow-2.16.13.9-3.12Clang from Xcode 13.6Bazel 6.5.0tensorflow-2.15.03.9-3.11Clang from Xcode 10.15Bazel 6.1.0tensorflow-2.14.03.9-3.11Clang from Xcode 10.15Bazel 6.1.0tensorflow-2.13.03.8-3.11Clang from Xcode 10.15Bazel 5.3.0tensorflow-2.12.03.8-3.11Clang from Xcode 10.15Bazel 5.3.0tensorflow-2.11.03.7-3.10Clang from Xcode 10.14Bazel 5.3.0tensorflow-2.10.03.7-3.10Clang from Xcode 10.14Bazel 5.1.1tensorflow-2.9.03.7-3.10Clang from Xcode 10.14Bazel 5.0.0tensorflow-2.8.03.7-3.10Clang from Xcode 10.14Bazel 4.2.1tensorflow-2.7.03.7-3.9Clang from Xcode 10.11Bazel 3.7.2tensorflow-2.6.03.6-3.9Clang from Xcode 10.11Bazel 3.7.2tensorflow-2.5.03.6-3.9Clang from Xcode 10.11Bazel 3.7.2tensorflow-2.4.03.6-3.8Clang from Xcode 10.3Bazel 3.1.0tensorflow-2.3.03.5-3.8Clang from Xcode 10.1Bazel 3.1.0tensorflow-2.2.03.5-3.8Clang from Xcode 10.1Bazel 2.0.0tensorflow-2.1.02.7, 3.5-3.7Clang from Xcode 10.1Bazel 0.27.1tensorflow-2.0.02.7, 3.5-3.7Clang from Xcode 10.1Bazel 0.27.1tensorflow-2.0.02.7, 3.3-3.7Clang from Xcode 10.1Bazel 0.26.1tensorflow-1.15.02.7, 3.3-3.7Clang from Xcode 10.1Bazel 0.26.1tensorflow-1.14.02.7, 3.3-3.7Clang from XcodeBazel 0.24.1tensorflow-1.13.12.7, 3.3-3.7Clang from XcodeBazel 0.19.2tensorflow-1.12.02.7, 3.3-3.6Clang from XcodeBazel 0.15.0tensorflow-1.11.02.7, 3.3-3.6Clang from XcodeBazel 0.15.0tensorflow-1.10.02.7, 3.3-3.6Clang from XcodeBazel 0.15.0tensorflow-1.9.02.7, 3.3-3.6Clang from XcodeBazel 0.11.0tensorflow-1.8.02.7, 3.3-3.6Clang from XcodeBazel 0.10.1tensorflow-1.7.02.7, 3.3-3.6Clang from XcodeBazel 0.10.1tensorflow-1.6.02.7, 3.3-3.6Clang from XcodeBazel 0.8.1tensorflow-1.5.02.7, 3.3-3.6Clang from XcodeBazel 0.8.1tensorflow-1.4.02.7, 3.3-3.6Clang from XcodeBazel 0.5.4tensorflow-1.3.02.7, 3.3-3.6Clang from XcodeBazel 0.4.5tensorflow-1.2.02.7, 3.3-3.6Clang from XcodeBazel 0.4.5tensorflow-1.1.02.7, 3.3-3.6Clang from XcodeBazel 0.4.2tensorflow-1.0.02.7, 3.3-3.6Clang from XcodeBazel 0.4.27.4 macOS GPU版本Python 版本编译器构建工具cuDNNCUDAtensorflow_gpu-1.1.02.7, 3.3-3.6Clang from XcodeBazel 0.4.25.18tensorflow_gpu-1.0.02.7, 3.3-3.6Clang from XcodeBazel 0.4.25.18从表中可以清晰看到两个趋势其一TensorFlow 2.13 起 Linux 默认编译器从 GCC 切换为 Clang与文档“Clang 是 2.13 起的默认编译器”相互印证其二macOS 从 2.16 起停止新增测试行与 pip 指南 中“macOS x86 支持止于 2.16”的声明一致且 macOS GPU 测试配置停留在 TensorFlow 1.x 时代——这正是“macOS 无官方 GPU 支持”的直接证据。8. 扩展阅读与仓库资源pip 安装指南官方预编译包安装、系统/软件要求、GPU 驱动与 CUDA 版本要求以及“为何需要从源码构建”的硬件背景。Docker 指南TensorFlow 镜像 tag 体系、--gpus all用法与容器内验证命令。Windows 源码构建指南面向 Windows 的对应路线MSYS2、Visual C Build Tools、LLVM 等。构建与安装错误速查官方跟踪的常见错误信息及其解决方向。安装导航与索引索引页了解三条安装路径pip / Docker / 源码的整体布局。版本更新脚本展示测试构建配置表如何随版本发布自动维护印证本文表格数据的官方来源。按本文流程操作你即可拥有一套从源码定制 TensorFlow 的完整能力无论是为特定 CPU 指令集优化、为老 GPU 补齐 PTX还是调试 TensorFlow 自身./configurebazel build Docker 镜像三条路径都能覆盖实际需求。赞分享文档开发工具教程【免费下载链接】docsTensorFlow documentation项目地址https://gitcode.com/gh_mirrors/doc/docs点击查看免费下载相关推荐Kivy 在 macOS 上的安装完全指南pip 安装、源码编译与 Kivy.app 使用Kivy 在 macOS 上的安装完全指南pip 安装、源码编译与 Kivy.app 使用 本篇技术指南围绕 Kivy 官方文档 doc/sources/in跨平台移动开发桌面应用UI组件NNI 在 Linux 与 macOS 上的完整安装指南从 pip 到源码构建与实验验证NNI 在 Linux 与 macOS 上的完整安装指南从 pip 到源码构建与实验验证 NNINeural Network Intelligence是微人工智能AutoML机器学习深度学习模型压缩特征工程在 macOS 上从源码构建 Rnote依赖安装、Meson 编译与安装全指南在 macOS 上从源码构建 Rnote依赖安装、Meson 编译与安装全指南 本篇技术指南以仓库中的 misc/building/rnote macos b桌面应用图形学上一篇Polybar 代码风格指南clang-format 格式化、缩进、注释与头文件规范实战下一篇Pitch-Agent 插件 deck-refresh 技能详解不重建整份 Deck精准更新 Pitch Deck 中的全部数字创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价 →
↑