执行脚本时,导入包from keras.preprocessing.image import ImageDataGenerator,报错ModuleNotFoundError: No module named 'keras',则pip安装keras:
pip install keras
安装失败,仍报错:
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied
使用sudo安装:
sudo python -m pip install keras
keras安装成功!
但是执行脚本时仍报错:ModuleNotFoundError: No module named 'tensorflow'
pip安装tensorflow:
sudo python -m pip install tensorflow
安装失败,报错:
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
MacOS安装tensorflow:
1. Set up(arm64)
bash ~/miniconda.sh -b -p $HOME/miniconda
source ~/miniconda/bin/activate
conda install -c apple tensorflow-deps
2.Install base TensorFlow
python -m pip install tensorflow-macos
3.Install tensorflow-metal plug-in
python -m pip install tensorflow-metal
成功!