导入lmoments3遇scipy.stats无frechet_r_gen属性错误求助
解决
module 'scipy.stats._continuous_distns' has no attribute 'frechet_r_gen' 错误 - 先检查当前conda环境的scipy版本,执行命令:
conda list scipy - 若scipy版本过低,用conda升级(避免pip与conda的依赖冲突):
conda update scipy - 升级后仍报错的话,是因为scipy中
frechet_r_gen已被weibull_min_gen替代,需修改lmoments3的distr模块:
找到conda环境中lmoments3的distr.py文件(路径示例:~/anaconda3/envs/你的环境名/lib/pythonX.X/site-packages/lmoments3/distr.py),把所有引用scipy.stats._continuous_distns.frechet_r_gen的代码替换为scipy.stats._continuous_distns.weibull_min_gen - 也可以安装适配性更好的lmoments3旧版本:
pip uninstall lmoments3pip install lmoments3==1.0.2 - 优先用conda安装包来适配当前环境:
conda install -c conda-forge lmoments3
内容的提问来源于stack exchange,提问作者Jane
相关产品推荐
相关产品推荐

