我用f2py创建了一个Fortran函数的模块,并在代码中使用。它用python3.7和numpy1.17.2在macoscatalina中创建了一个.pyf函数和一个.so文件。同样的代码在ubuntu18.04中运行时会产生模块导入错误no module found。你知道吗
所以我尝试在Ubuntu中创建相同的模块,代码运行良好。你知道吗
现在我已经在Ubuntu中创建了这个模块,我在macOS中运行了代码,代码生成模块导入错误no module found。你知道吗
我创建了两个不同的模块,一个在Ubuntu中,另一个在macOS中,两个模块都可以单独工作,但是Ubuntu和macOS中的一个模块不能一起工作。你知道吗
任何可能的帮助都是可观的
敬礼
用于在macOS中创建的模块创建指令
python3.7 -m numpy.f2py SLSQP_ONLY.f -m SLSQP4 -h SLSQP4.pyf
python3.7 -m numpy.f2py -c SLSQP4.pyf SLSQP_ONLY.f
用于在Ubuntu中创建
python3.7 -m numpy.f2py SLSQP_ONLY.f -m SLSQP5 -h SLSQP5.pyf
python3.7 -m numpy.f2py -c SLSQP5.pyf SLSQP_ONLY.f
from __future__ import division, print_function, absolute_import
from os.path import dirname, realpath, sep, pardir
import sys
sys.path.append(dirname(realpath(__file__)) + sep + pardir + sep + "DA_Opt_Module")
sys.path.insert(0,__file__)
print(sys.path)
import numpy as np
from linalg_da.decomp_cholesky import cho_factor, cho_solve
import sys
import warnings
from Python_linesearch_Only import (line_search_wolfe2,
line_search_wolfe2 as line_search,
LineSearchWarning)
__all__ = []
__all__ = ['minimize', 'minimize_scalar']
from warnings import warn
from scipy._lib.six import callable
from SLSQP5 import slsqp # Fortran wrapper for SLSQP minimizer problems
如果我使用SLSQP5,代码在Ubuntu和macOS中工作,产生模块导入错误;如果我使用SLSQP4,Ubuntu产生模块导入错误,代码在macOS中工作。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐