简体   繁体   English

f2py:找不到命令

[英]f2py: command not found

Mac OS Sierra. Mac OS Sierra。

In terminal, while trying to execute a .sh file that involves a Python script with Fortran portions, I got this message: 在终端中,在尝试执行包含带有Fortran部分的Python脚本的.sh文件时,出现以下消息:

lenscov-master Roger$ ./run_covariances.sh recompile
rm *.o *.so
rm: *.so: No such file or directory
make: [clean] Error 1 (ignored)
gfortran -fPIC -c *.f -lgfortran -lifcore
f2py-2.7 -c loop_lensing.f90 *.o -m loop_lensing --opt=-ffixed-line-length-
none --opt=-O3
/bin/sh: f2py-2.7: command not found
make: *** [loop_lensing] Error 127

However, it is fine just test-running the .f90 file: 但是,只需测试运行.f90文件就可以了:

f2py -c loop_lensing.F90 -m test

returns a bunch of normal-looking information. 返回一堆看起来正常的信息。

Does anyone maybe know what is going on? 有人知道发生了什么吗?

it is fine just test-running the .f90 file 只需测试运行.f90文件就可以了

means you have f2py installed. 表示您已安装f2py But the script use f2py-2.7 但是脚本使用f2py-2.7

You need to check the version of installed f2py , and make sure f2py-2.7 redirects to the corrent f2py . 您需要检查已安装的f2py的版本,并确保f2py-2.7重定向到相应的f2py

The script (or a Makefile) tries to invoke f2py-2.7 instead of f2py . 该脚本(或Makefile)尝试调用f2py-2.7而不是f2py If it is your script or you can easily adjust it, rename all f2py-2.7 to f2py . 如果它是您的脚本,或者您可以轻松调整它, f2py-2.7所有f2py-2.7重命名为f2py Otherwise you have to tell us more about the script and show the code of the script. 否则,您必须告诉我们更多有关脚本的信息,并显示脚本的代码。

As foodtooth says, make sure you have f2py 2.7 and not f2py-3, but I don't expect that to be a problem. 正如foodtooth所说,请确保您使用的是f2py 2.7,而不是f2py-3,但我不希望这是个问题。

You could also make a symlink f2py -> f2py-2.7 for the script. 您还可以为脚本创建符号链接f2py-> f2py-2.7。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM