为什么我的Jupyter会给我一个用f2py编译的fortran代码的ModuleNotFound错误?

2024-09-27 00:12:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我的Jupyter笔记本给了我一个用f2py编译的fortran代码的ModuleNotFound错误。f2py位于make.sh文件中,我在安装包时运行该文件。一些信息

  1. 哪个f2py$'user/anaconda3/envs/petitRT/bin/f2py'
  2. 哪个python$'user/anaconda3/envs/petitRT/bin/python'
  3. python——版本$python 3.7.9
  4. make.sh文件有$f2py-c--opt='-O3-funroll循环-ftree向量化-ftree循环优化-msse-msse2-m3dnow'-m fort_rebin fort_rebin.f90
  5. 创建的.so文件名为$'fort_rebin.cpython-37m-x86_64-linux-gnu.so'
  6. 最后,哪个jupyter$'user/anaconda3/envs/petitRT/bin/jupyter'

有人能帮我解开这个谜吗

一些编辑: make.sh文件和fort_rebin.f90位于最上面的/目录中

我需要导入的fortran代码位于inner/directory/rebin\u give\u width.f90中。但是,软件包安装没有说明编译rebin_give_width.f90(make.sh中也没有提到)。我现在看到它没有生成任何.so文件

问题是,这个lib以前工作过。由于其他原因,我重新安装了软件包,结果发生了一些事情

调用库时出错-

$import rebin_将_宽度指定为rgw

ModuleNotFoundError回溯(上次最近调用) 在里面 ----&燃气轮机;1导入rebin\u以rgw的形式给出\u宽度

ModuleNotFoundError:没有名为“rebin\u give\u width”的模块

好吧,我找到了解决办法。我不知道为什么它以前能工作,也不知道为什么它不是安装的一部分。但是,我在make.sh中包含了命令$f2py-c internal/directory/rebin\u give\u width.f90-m rebin\u give\u width和语句$import upmost\u directory.rebin\u give\u width now works


Tags: 文件makebinsoshwidthf90f2py

热门问题