https://trayansh.medium.com/setting-machine-learning-environment-on-m1-mac-apple-silicon-959836bf494d
sudo xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
So if you haven’t config the brew environment variable, the correct step to config the brew environment variable on your Mac is:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
Now we need to activate the changes. Type this command to activate and try drew doctor again:
source ~/.bash_profile
brew install gcc
brew install cmake
brew install wget
change as your Mac name
cmake \
-DCMAKE_SYSTEM_PROCESSOR=arm64 \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DWITH_OPENJPEG=ON \
-DWITH_IPP=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=/Users/yanli/miniforge3/opencv_contrib-4.5.0/modules \
-D PYTHON3_EXECUTABLE=/Users/yanli/miniforge3/envs/ml/bin/python3 \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D BUILD_EXAMPLES=ON ..