MAC M1使用tensorflow报错

MAC M1使用tensorflow报错


报错信息如下

2021-11-21 08:52:23.597314: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
2021-11-21 08:52:23.597598: W tensorflow/core/platform/profile_utils/cpu_utils.cc:126] Failed to get CPU frequency: 0 Hz
2021-11-21 08:52:23.598919: F tensorflow/core/grappler/costs/op_level_cost_estimator.cc:710] Check failed: 0 < gflops (0 vs. 0)type: "CPU"
model: "0"
num_cores: 8
environment {
  key: "cpu_instruction_set"
  value: "ARM NEON"
}
environment {
  key: "eigen"
  value: "3.3.90"
}
l1_cache_size: 16384
l2_cache_size: 524288
l3_cache_size: 524288
memory_size: 268435456

问题:python3.9和该版本的tensorflow不适应
解决方案:
需要安装python3.8,然后在https://github.com/apple/tensorflow_macos/releases下载下载的文件版本是tensorflow_macos-0.1alpha3.tar.gz。进入解压目录,在终端输入:

pip install --upgrade --no-dependencies --force numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl grpcio-1.33.2-cp38-cp38-macosx_11_0_arm64.whl tensorflow_addons_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl
pip install absl-py astunparse flatbuffers gast google_pasta keras_preprocessing opt_einsum protobuf tensorflow_estimator termcolor typing_extensions wrapt wheel tensorboard typeguard
pip install --upgrade --no-dependencies tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl

你可能感兴趣的:(Python的基本用法和应用,python,tensorflow)