You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python3中tensorflow_text安装成功但导入运行报错怎么解决?

问题根因
  • 核心是版本不匹配问题,分为两层:
    1. 你安装的tensorflow_text版本是在更高版本的macOS上编译的,用到了低版本macOS系统库libSystem.B.dylib里没有的____chkstk_darwin符号,导致动态库加载失败
    2. 你当前使用的Python 3.6早已停止官方维护,新版本的tensorflow、tensorflow_text均不再支持该Python版本,强制安装高版本包必然出现兼容问题
解决步骤

按优先级从高到低排列:

  • 优先升级环境适配主流版本
    1. 卸载当前环境已安装的不兼容包:
      pip uninstall -y tensorflow tensorflow-text
    2. 把Python版本升级到3.8~3.10区间,这两个版本对tensorflow生态的兼容度最高
    3. 安装版本严格匹配的tensorflow和tensorflow_text,两者的次版本号必须完全一致,示例命令:
      pip install tensorflow==2.10.0 tensorflow-text==2.10.0
  • 若无法升级Python/系统版本,安装适配老环境的历史版本
    Python3.6最高支持的tensorflow版本为2.6.0,对应安装命令:
    pip install tensorflow==2.6.0 tensorflow-text==2.6.0
    如果安装后仍然报符号找不到错误,继续降低到2.5版本系列:
    pip install tensorflow==2.5.3 tensorflow-text==2.5.0
  • 临时测试可用conda安装适配包
    conda源的预编译包会自动匹配当前系统的依赖环境,无需手动对齐版本:
    conda install -c conda-forge tensorflow-text

内容的提问来源于stack exchange,提问作者HANS

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.07 13:00:02