我尝试通过pip install在Windows 7中安装库PyDSTool。安装版本PyDSTool == 0.90.2。在此之前,我安装了依赖numpy和scipy。 当我尝试将模块PyDSTool导入IDE python时,我收到类似这样的错误:
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
import PyDSTool
File "C:\Python27\lib\site-packages\PyDSTool\__init__.py", line 77, in <module>
raise RuntimeError("SciPy v0.5.1 or above is required")
RuntimeError: SciPy v0.5.1 or above is required
我更正了文件中的代码(C:\ Python27 \ lib \ site-packages \ PyDSTool__init __。py&#34;,第77行),以便
if tuple(vernums) < tuple([int(n) for n in "0.5.1".split(".")]):
raise RuntimeError("SciPy v0.5.1 or above is required")
#if vernums[1] < 5:
# raise RuntimeError("SciPy v0.5.1 or above is required")
因为scipy的版本= 1.0.0&gt; 0.5.1 SciPy 1.0.0发布于2017-10-25
导入模块的下一次尝试给出了下一个异常
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
import PyDSTool
File "C:\Python27\lib\site-packages\PyDSTool\__init__.py", line 87, in <module>
from .Events import *
File "C:\Python27\lib\site-packages\PyDSTool\Events.py", line 13, in <module>
from .Variable import *
File "C:\Python27\lib\site-packages\PyDSTool\Variable.py", line 15, in <module>
from .FuncSpec import ImpFuncSpec
File "C:\Python27\lib\site-packages\PyDSTool\FuncSpec.py", line 17, in <module>
from .Symbolic import QuantSpec, allmathnames_symbolic
File "C:\Python27\lib\site-packages\PyDSTool\Symbolic.py", line 178, in <module>
funcnames = [n for n in allmathnames if hasattr(eval(modlookup[n]+n),
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'sph_jn'
我玩了打印功能,发现 scipy.special 没有hava attr &#34; sph_jn&#34; ,当python尝试eval时会出现此异常下一个代码
funcnames = [n for n in allmathnames if hasattr(eval(modlookup[n]+n), "__call__")]
任何人都可以帮我解决这个问题吗?
答案 0 :(得分:3)
正如Warren已建议的那样,在parseUtils.py
'h2vp', 'sph_jn', 'sph_yn', 'sph_jnyn', 'sph_in',
'sph_kn', 'sph_inkn', 'riccati_jn', 'riccati_yn',
到
'h2vp', 'spherical_jn', 'spherical_yn', 'spherical_in',
'spherical_kn', 'riccati_jn', 'riccati_yn',
将解决您的问题。