I am trying to run a simple Fortran subroutine using numpy.f2py as described on: http://docs.scipy.org/doc/numpy/user/c-info.python-as-glue.html#calling-f2py-from-python
When I try to compile (f2py.compile(source, modulename='add')) from python I get the following error:
"Could not locate executable C:Python27pythonw.exe
Executable C:Python27pythonw.exe does not exist"
Looking for this file I found that C:\Python27\pythonw.exe does exist in my system, so could it possible be a problem with the path?
In any case, any advice on how to make my code work?
I found a quick fix for the problem. However, I cannot guarantee that nothing else will break when using this.
In the file:
C:\Python27\Lib\site-packages\numpy\f2py\__init__.py
in line 40, change
s,o = exec_command(c)
to
s = os.system(c)
It seems that the main error lies in numpy.distutils.exec_command, which seems to omit the backslashes when calling python. Again, I may be playing with forces I do not understand, by replacing the more involved exec_command by os.system call. But it works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With