How to install tensorflow on Mac|from tensorflow.keras.utils import plot_model|Solved
1. Today, after using mac to create a tensor flow package, I found an error when using the environment:
from tensorflow.keras.utils import plot_model
Process finished with exit code 132 (interrupted by signal 4: SIGILL)
After checking, I found that I was using a mac chipe M2 chip, and then ran the version check:
2. sw_vers -productVersion
After inputting, it will return the version information of your current mac
. 3. At this time, we manually create the conda environment, and install tensorflow when creating it.
4. First Create an environment.yml file:
fill in the following content:
name: apple_tensorflow
channels:
- conda-forge
- nodefaults
dependencies:
- absl-py
- astunparse
- gast
- google-pasta
- grpcio
- h5py
- ipython
- keras-preprocessing
- numpy
- opt_einsum
- pip=20.2.4
- protobuf
- python-flatbuffers
- python=3.8
- scipy
- tensorboard
- tensorflow-estimator
- termcolor
- typeguard
- typing_extensions
- wheel
- wrapt
5. Then enter the following command line content:
remember to replace your own env name, and the directory where the environment.yml you just created is located, and the last layer of directory must be the file name➕type suffix
conda env create --file=PATH_TO_ENVIRONMENT.YML --name=YOUR_ENV_NAME_HERE
6. Then you can activate the created env yourself
conda activate env_name
For more specific content and explanations, please refer to:
https://github.com/apple/tensorflow_macos/issues/153
https://github.com/apple/tensorflow_macos
https://raw.githubusercontent.com/mwidjaja1/DSOnMacARM/main /environment.yml
respect!!!!!