简体   繁体   English

Tensorflow < 2.4 芯片 M1

[英]Tensorflow < 2.4 chip M1

I am working on a project which requirements need python 3.7 and tensorflow 2.3.1.我正在开发一个需要 python 3.7 和 tensorflow 2.3.1 的项目。 The problem, I have a MacBook Pro with M1 chip.问题是,我有一台带有 M1 芯片的 MacBook Pro。 I was able to install and run TF 2.4.我能够安装和运行 TF 2.4。 However, I ran into more complicated compatibility issues.但是,我遇到了更复杂的兼容性问题。 Does anyone know how could I solve this?有谁知道我该如何解决这个问题?

M1 has a compatibility issue with tensorflow. M1 与 tensorflow 存在兼容性问题。 There is a workaround provided by Apple and other blogs. Apple 和其他博客提供了一种解决方法。 I have recently tried the same and have provided the summary below:我最近尝试了相同的方法并提供了以下摘要:

Tensorflow: OS: BigSur(11.2.3) Tensorflow:操作系统:BigSur(11.2.3)

Install command line tools:安装命令行工具:

  • xcode-select --install

Install miniforge:安装 miniforge:

After download run下载后运行

  1. chmod +x ~/<dir>/Miniforge3-MacOSX-arm64.sh
  2. sh ~/<dir>/Miniforge3-MacOSX-arm64.sh

dir: directory to which miniforge is downloaded. dir: miniforge 下载到的目录。

Or或者

  1. brew install miniforge
  2. After download change source to miniforge3下载后将源更改为 miniforge3
  3. source ~/miniforge3/bin/activate

Download the environment.yml file from https://github.com/mwidjaja1/DSOnMacARMhttps://github.com/mwidjaja1/DSOnMacARM下载 environment.yml 文件

Setup a new conda environment using the yml file:使用 yml 文件设置新的 conda 环境:

  • conda env create --file=environment.yml --name <env_name>
  • Activate new environment激活新环境

Install tensorflow dependencies:安装 tensorflow 依赖项:

  • conda install -c apple tensorflow-deps

Install base tensorflow:安装基础张量流:

  • python -m pip install tensorflow-macos

Install tensorflow-metal plugin:安装 tensorflow-metal 插件:

  • python -m pip install tensorflow-metal

Possible Issues:可能的问题:

  • Miniforge uses conda-forge to install packages Miniforge 使用 conda-forge 安装软件包
  • Method to route channel to conda-forge将通道路由到 conda-forge 的方法
  • conda install -c conda-forge matplotlib
  • conda install or pip install might not work

Packages available for libraries in conda-forge:可用于 conda-forge 中的库的软件包:

https://anaconda.org/conda-forge https://anaconda.org/conda-forge

Only these will work只有这些会起作用

Sources:资料来源:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM