导入包 PyDSTool 不起作用 [英] import of package PyDSTool doesn't work

查看:38
本文介绍了导入包 PyDSTool 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 Windows 7 中通过 pip install 安装库 PyDSTool.安装版本 PyDSTool == 0.90.2.在此之前,我安装了依赖项 numpy 和 scipy.当我尝试将模块 PyDSTool 导入 IDE python 时,出现如下错误:

I tried to install the library PyDSTool via pip install in windows 7. Installed version PyDSTool == 0.90.2. Before that I installed dependencies numpy and scipy. Wwhen I tried to import the module PyDSTool into IDE python, I got error something like this:

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",第 77 行),就是这样

I corrected the code in the file (C:\Python27\lib\site-packages\PyDSTool__init__.py", line 77) so that's it

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 > 0.5.1SciPy 1.0.0 发布 2017-10-25

because version of scipy = 1.0.0 > 0.5.1 SciPy 1.0.0 released 2017-10-25

下次尝试导入模块时出现下一个异常

The next attempt to import the module gave next exception

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 没有 attr "sph_jn" 并且当 python 尝试 eval 下一个代码时会出现这个异常

I played with the print function and found out that scipy.special dont hava attr "sph_jn" and this exception arises when python is trying eval next code

funcnames = [n for n in allmathnames if hasattr(eval(modlookup[n]+n), "__call__")]

谁能帮我解决这个问题?

Can anyone help me with this problem?

推荐答案

正如 Warren 已经建议的那样,替换parseUtils.py

As Warren already suggested, replacing the following 2 lines (line 46-47) in 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',

将解决您的问题.

这篇关于导入包 PyDSTool 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆