【问题标题】:Vs code install tensorflow on Mac M1 miniVS Code 在 Mac M1 mini 上安装 tensorflow
【发布时间】:2021-12-11 13:47:02
【问题描述】:

首先我发现如果我愿意安装 tensorflow,就会安装 h5py fst。 其实我不知道错误的意思。 我的工作环境是 MAC os:Monterey 12.0.1 M1 芯片 IDLE:VS代码python版本3.9.9 还有下面的错误

Command errored out with exit status 1:
   command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/f1/dg3072vj3kv3xrm6gfqss0nm0000gn/T/tmpeilgwiek
       cwd: /private/var/folders/f1/dg3072vj3kv3xrm6gfqss0nm0000gn/T/pip-install-hc7lie5i/h5py_bcf2a489a242489e8360576c4d779270
  Complete output (70 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-11-universal2-3.8
  creating build/lib.macosx-11-universal2-3.8/h5py
  .........
  copying h5py/tests/test_vds/test_virtual_source.py -> build/lib.macosx-11-universal2-3.8/h5py/tests/test_vds
  copying h5py/tests/test_vds/__init__.py -> build/lib.macosx-11-universal2-3.8/h5py/tests/test_vds
  copying h5py/tests/test_vds/test_lowlevel_vds.py -> build/lib.macosx-11-universal2-3.8/h5py/tests/test_vds
  copying h5py/tests/data_files/vlen_string_s390x.h5 -> build/lib.macosx-11-universal2-3.8/h5py/tests/data_files
  copying h5py/tests/data_files/vlen_string_dset_utc.h5 -> build/lib.macosx-11-universal2-3.8/h5py/tests/data_files
  copying h5py/tests/data_files/vlen_string_dset.h5 -> build/lib.macosx-11-universal2-3.8/h5py/tests/data_files
  running build_ext
  Building h5py requires pkg-config unless the HDF5 path is explicitly specified
  error: pkg-config probably not installed: FileNotFoundError(2, 'No such file or directory')
  ----------------------------------------
  ERROR: Failed building wheel for h5py
Failed to build h5py
ERROR: Could not build wheels for h5py, which is required to install pyproject.toml-based projects

【问题讨论】:

标签: tensorflow installation h5py


【解决方案1】:

我在装有 Python 3.9.9 和 pip 21.3.1 的 MacBook Pro M1 上遇到了同样的问题。经过几次尝试,创建如下虚拟环境为我解决了这个问题:

$ python3 -m venv ~/tensorflow-metal
$ source ~/tensorflow-metal/bin/activate
$ python3 -m pip install -U pip
$ python3 -m pip install tensorflow-macos
$ python3 -m pip install tensorflow-metal

使用以下版本: 张量流-macos 2.7.0, 张量流-金属 0.3.0

【讨论】:

    猜你喜欢
    • 2022-11-15
    • 2021-05-17
    • 2021-08-12
    • 2022-06-11
    • 2021-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多