I have a Makefile that is using f2py to compile a FORTRAN code for Python, but it is giving me error 127 because it can't find f2py. However, it is able to locate f2py with the "which" command.
Here is part of my Makefile:
main : fortran_modules
which f2py && f2py -c --opt="${OPT}" -m fmodules ${SRC} ${FMOD}
The output is:
which f2py && f2py -c --opt="-O2" -m fmodules fortran/common.f90 fortran/kdbinsert.f90 fortran/fhelper.f90
/usr/local/bin/f2py
/bin/sh: 1: f2py: not found
In the output, it locates the command (/usr/local/bin/f2py), but in the next line, it says "f2py not found".
What is going on, and how can I fix it?
CodePudding user response:
The error:
/bin/sh: 1: f2py: not found
shows us that f2py
is a shell script and that its first line uses the shebang syntax: #!/some/interpreter
. What this error means is that /some/interpreter
, whatever it is in your f2py
script, doesn't exist on your system.
So you'll have to look at the /usr/local/bin/f2py
script and figure out what program it's trying to invoke, and make sure that's installed properly.