Pergunta

I am relatively new to python. I am using Enthought Canopy for my work. After importing f2py from numpy, I keep on running into the invalid syntax error when trying to execute:

f2py -m (modname) -c --fcompiler=gfortran (prog.f90)

Needless to say, I have gfortran installed, and the program is present in the working directory. Even trying to run

f2py -c --help-fcompiler

as recommended somewhere on the net leads to an error saying : name 'c' is not defined. On typing f2py:

module 'numpy.f2py' from 'C:\Users\acer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.1262.win-x86_64\lib\site-packages\numpy\f2py\__init__.pyc'

which indicates that f2py is installed. Could anyone have an idea where I am going wrong?

Foi útil?

Solução

You can try running the following command in the directory where your script is doing:

on Windows

python path_to_scripts\f2py.py -c -m module_name prog.f90 --fcompiler=gfortran

on Linux

python path_to_scripts/f2py.py -c -m module_name prog.f90 --fcompiler=gfortran

Where path_to_scripts is the path to the Scripts directory. For example: C:\Python27\Scripts. In case of Canopy you have to look where this directory is...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top