I want to import fortran files to my python script by using f2py.
For that I compile them via
f2py -c -m my_lib *.f
which produces the file "my_lib.cpython-38-darwin.so" which I import to my script by
import my_lib.
On my Intel-based Macbook that works well. However, running the script on an M1 machine yields the following error:
ImportError: dlopen(./my_lib.cpython-38-darwin.so, 0x0002): tried: './my_lib.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/my_lib.cpython-38-darwin.so' (no such file), '/usr/lib/my_lib.cpython-38-darwin.so' (no such file)
Same happens when I start my terminal in Rosetta mode.
Any idea how to solve this issue?