Reputation: 31
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?
Upvotes: 3
Views: 1485
Reputation: 552
Another approach without "losing" o
(output
) in s = os.system(c)
is to implement
c = c.replace("\\", "\\\\")
before s,o = exec_command(c)
or status, output = exec_command(c)
.
Upvotes: 0
Reputation: 1150
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.
Upvotes: 2