after installing python, numpy and scipy_dist_utils i typed f2py onto the python interpretor the result is as below
>>> f2py
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
f2py
NameError: name 'f2py' is n开发者_开发问答ot defined
>>> import numpy
>>> f2py
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
f2py
NameError: name 'f2py' is not defined
from numpy import f2py solved the problem but this does not work now f2py -c --help-fcompiler
f2py -c --help-fcompiler Traceback (most recent call last): File "", line 1, in f2py -c --help-fcompiler NameError: name 'c' is not defined
What has gone wrong? could anyone help me with this?
If you are trying to run f2py, you do that from your command shell (bash or whatever on UNIX machines, CMD on Windows), not from the Python interpreter. There isn't a whole lot you can do with
Also, scipy_distutils is very, very old and not at all used anymore. Whatever instructions that told you to install that are incredibly out of date. For a somewhat more up to date set of instructions:
http://www.scipy.org/F2py
You have to type:
import numpy.f2py
Also, be sure to have a recent version of numpy
.
Did you type from numpy import f2py
before trying to use f2py
?
Robert Kern is correct. You cannot run it from within python. I had a similar error on my windows computer. The problem is that f2py is not in the path.
You'll have to call f2py in the following method from the command prompt.
python C:\Path\to\f2py.py
That should allow it to be called.
As an example, I have python 3.4 installed in the C directory in the folder Python34
with f2py in the subfolder Scripts
. So, my call to f2py is python C:\Python34\Scripts\f2py.py
.
精彩评论