Question

I am using Python 3.2 under Windows 7. I need some numerical subroutines for my Python script, and I would like to write them in Fortran and use f2py to make them compatible with my script.

As per the f2py documentation, I installed numpy (v1.6.1), then tried running f2py on the command line to check the installation. Windows keeps telling me that "f2py is not recognized as an internal or external command, operable program, or batch file." I tried adding "C:\Python32\Scripts" to my PATH, but that didn't help. (C:\Python32 is my Python installation directory, and is also in my PATH, numpy is also installed here)

What am I doing wrong?

Was it helpful?

Solution

You need to run f2py.py. If you want to omit the .py extension, add .PY to your PATHEXT environment variable.

OTHER TIPS

In 2016, you should be able to run f2py as an executable numpy module from the command line:

python -m numpy.f2py

This avoids needing to mess around with environment variables, and works on my Windows machine with numpy 1.10.4.

(Further discussion: https://github.com/numpy/numpy/pull/5565, https://github.com/numpy/numpy/issues/7532)

did you try f2py.py ? or "python f2py.py" or "python f2py"? depending on the file and if you have windows use python to open py ext files

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top