gpt4 book ai didi

python - 安装 "Sundials"以使用 Assimulo

转载 作者:太空狗 更新时间:2023-10-30 01:38:33 27 4
gpt4 key购买 nike

首先,我可能应该说明我这样做的原因:我想尝试使用一些不同的微分方程求解器来比较我正在从事的项目的效率和内存使用情况。因此我想安装 Assimulo,因为它使用了一套求解器并且非常用户友好。

在安装它之前,我发现我需要安装“sundials”:

https://computation.llnl.gov/casc/sundials/download/download.html

因为我使用的是 64 位 ubuntu,所以我下载了它,解压缩并使用“-fPIC”标志安装它。安装“似乎”进行得很顺利,没有退出状态消息。

然后我使用这些说明安装了 assimulo:

http://www.jmodelica.org/assimulo_home/installation.html

我将“usr/local/lib”指定为安装日晷的路径,因为这是脚本运行时在终端中安装日晷的路径。

为了检查它是否正常工作,我下载并安装了 nose 来执行 nosetest,但是,它告诉我有问题。错误的一部分是:

======================================================================
ERROR: Failure: ImportError (No module named sundials)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
addr.filename, addr.module)
File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/usr/local/lib/python2.7/dist-packages/assimulo/tests/test_examples.py", line 21, in <module>
from assimulo.examples import *
File "/usr/local/lib/python2.7/dist-packages/assimulo/examples/cvode_gyro.py", line 22, in <module>
from assimulo.solvers import CVode
File "/usr/local/lib/python2.7/dist-packages/assimulo/solvers/__init__.py", line 23, in <module>
from sundials import IDA, CVode
ImportError: No module named sundials

nose 报告的其他五个错误非常相似。我理解它的意思,因为它似乎模块不在正确的位置,但我该如何修复它?

如果有人能帮助我,我将不胜感激。在过去的几天里,我对此做了一场绝对的噩梦。我是 Linux 的新手并且一直在尽我最大的努力,但我安装的所有东西似乎都无法正常工作。

操作系统:Ubuntu 12.10 64 位。 python 版本:2.7Numpy/Scipy 已安装。

编辑:这是我安装 assiumulo 的方式,如果有帮助,终端输出:

nathan@ubuntu:~/Documents/pythoncode/Assimulo-2.1.1$ sudo python setup.py install     --sundials-home=/usr/local/lib
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "assimulo.implicit_ode" sources
building extension "assimulo.ode" sources
building extension "assimulo.explicit_ode" sources
building extension "assimulo.problem" sources
building extension "assimulo.solvers.euler" sources
building extension "assimulo.lib.dopri5" sources
f2py options: []
adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
adding 'build/src.linux-x86_64-2.7' to include_dirs.
adding 'build/src.linux-x86_64-2.7/assimulo/thirdparty/hairer/dopri5-f2pywrappers.f' to sources.
building extension "assimulo.lib.rodas" sources
f2py options: []
adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
adding 'build/src.linux-x86_64-2.7' to include_dirs.
adding 'build/src.linux-x86_64-2.7/assimulo/thirdparty/hairer/rodas-f2pywrappers.f' to sources.
building extension "assimulo.lib.radau5" sources
f2py options: []
adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
adding 'build/src.linux-x86_64-2.7' to include_dirs.
adding 'build/src.linux-x86_64-2.7/assimulo/thirdparty/hairer/radau5-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelFCompiler
Could not locate executable ifort
Could not locate executable ifc
customize LaheyFCompiler
Could not locate executable lf95
customize PGroupFCompiler
Could not locate executable pgfortran
customize AbsoftFCompiler
Could not locate executable f90
customize NAGFCompiler
Found executable /usr/bin/f95
customize VastFCompiler
customize CompaqFCompiler
Could not locate executable fort
customize IntelItaniumFCompiler
Could not locate executable efort
Could not locate executable efc
customize IntelEM64TFCompiler
customize Gnu95FCompiler
Found executable /usr/bin/gfortran
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
running scons
running install_lib
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/Assimulo-2.1.1.egg-info
Writing /usr/local/lib/python2.7/dist-packages/Assimulo-2.1.1.egg-info
running install_clib
customize UnixCCompiler
nathan@ubuntu:~/Documents/pythoncode/Assimulo-2.1.1$

最佳答案

安装 assimulo 时只尝试将 /usr 作为 sundials-home 目录。我在每个示例中搜索了日晷模块的文件 cvodes.h,它位于 /usr/include/cvodes。 sundials-home 目录使用的是 include 目录的父目录,所以 /usr

关于python - 安装 "Sundials"以使用 Assimulo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14484877/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com