python - 从 scipy.interpolate 导入 RegularGridInterpolator 时出错
问题描述
我在尝试为大学课程运行代码时遇到问题。主文件 BASEchange.py 尝试导入 2 个名为“NODE”和“MESHMODEL”的模块。反过来,“MESHMODEL”从 scipy.interpolate 导入 RegularGridInterpolator。
当我在 mac 终端中运行程序时,使用“python BASEchange.py -h”,我收到以下错误:
ImportError:无法导入名称RegularGridInterpolator
我通过 pip 安装了 scipy。
这是 meshModel.py 的第一行:
import sys, os, platform, subprocess, stat, re, abc, math, linecache, shutil
import numpy as np
from scipy.interpolate import RegularGridInterpolator
from scipy import interpolate
from scipy.sparse import csc_matrix, lil_matrix, tril, find
from scipy.sparse.csgraph import reverse_cuthill_mckee
提前致谢!
解决方案
你可能有错误的 scipy 版本。请注意,RegularGridInterpolator
仅支持version 0.14.
请执行下列操作。
升级你的点子
对于 Python 3:
python3 -m pip install --upgrade pip
对于 Python 2:
python2 -m pip install --upgrade pip
然后按照这里的命令安装 scipy:
python -m pip install --user scipy
推荐阅读
- r - R 中的 revoScaleR::rxGlm() 问题 - GLM 残差
- python - 我怎样才能使我的信号工作并解决这个问题?
- qt - 在 QML 文本元素中启用“elide”属性,但在从右到左的用户界面中
- c++ - 为什么分配动态内存时虚拟内存没有减少
- c - 即使我输入了一个数字,为什么我的代码仍然返回 1 和错误消息?
- react-native - 获取参数问题反应原生
- c# - 在不同的 efpt.renaming.json 文件中重命名 .net 核心应用程序
- python - 图例有时具有重复值
- c++ - 如何返回指针函数?
- directed-acyclic-graphs - 如何使用 dagitty 自定义 DAG 的外观