'(M1 Mac) Geodjango GDAL: mach-o, but wrong architecture

I am trying to get GeoDjango running on mac os and have hit a problem with GDAL.

I have downloaded and installed GDAL without problem (Gdal Complete Binary) also installed from homebrew too.

Unfortunately when i was installed gdal with homebrew django can't find the gdal and throws gdal did not find error, after that. I installed from KyngChaos GeoDjango Binary django find gdal but now throws that;

OSError: dlopen(/Library/Frameworks/gdal.framework/gdal, 6): no suitable image found.  Did find:
    /Library/Frameworks/gdal.framework/gdal: mach-o, but wrong architecture
    /Library/Frameworks/gdal.framework/gdal: mach-o, but wrong architecture
    /Library/Frameworks/GDAL.framework/Versions/3.1/GDAL: mach-o, but wrong architecture
    /Library/Frameworks/GDAL.framework/Versions/3.1/GDAL: mach-o, but wrong architecture

I think the Kyngchaos build not compaitable with arm platform

Any help would be much appreciated.

Django Version : 3.0 also tried 3.2
Gdal Version : 3.2/3.1/2.4 All of them tried
Python Version: 3.8
Postgresql Version : 13
Postgis/Geos installed
gdal-config --libs:

-L/opt/homebrew/Cellar/gdal/3.2.2_3/lib -lgdal


Solution 1:[1]

brew info gdal

which should give you something like:

/opt/homebrew/Cellar/gdal/3.2.2_3/lib/libgdal.dylib

put that into your GDAL_LIBRARY_PATH.

From here, you can debug it further by putting a break point in your exception's line.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1