无法引用numpy_financial模块问题如何解决?

import numpy_financial as npf

=====================#

def sta001(k, nyear, xd):
d2 = npf.fv(k, nyear, -xd, -xd);
d2 = round(d2)
return d2

=====================#

运行报错:
Traceback (most recent call last):
File “/Users/zhangmiao/Desktop/lianghua/c01_01_k101.py”, line 4, in
import numpy_financial as npf
ModuleNotFoundError: No module named ‘numpy_financial’

我确定已经使用 pip 安装了 numpy_financial,在 anaconda 的环境里也能看到 numpy_financial。
请教高手指点。

讨论数量: 2
Jason990420

How and where you run your script ? the same, how and where the module installed ? It maybe caused by which the python run.

1年前 评论

你运行的 py 环境和你的 anaconda 是同一个环境吗?你要确保你看到的和你运行的是同一个环境,最简单就是你用 python3 -m pip list 一下,有没有你这个库。

1年前 评论