0
点赞
收藏
分享

微信扫一扫

tensorly | ImportError: cannot import name ‘check_random_state‘ from ‘tensorly.random‘ 解决方法


TensorLY 官方文档:​​http://tensorly.org/stable/index.html​​

tensorly | ImportError: cannot import name ‘check_random_state‘ from ‘tensorly.random‘ 解决方法_报错解决

pip 安装 tensorly

pip install -U tensorly

在复现基于​​特征重构的张量 ARIMA​​,调用 tensorly 时遇到报错如下:

tensorly | ImportError: cannot import name ‘check_random_state‘ from ‘tensorly.random‘ 解决方法_ImportError_02


分析认为:报错原因在于版本问题,有看到网上解决方案如下:

tensorly | ImportError: cannot import name ‘check_random_state‘ from ‘tensorly.random‘ 解决方法_ImportError_03

但我去 site-packages 里找相应 .py 文件,发现导入包的方式跟它的截图有些不一致。如下所示:

tensorly | ImportError: cannot import name ‘check_random_state‘ from ‘tensorly.random‘ 解决方法_特征重构的张量 ARIMA_04


因为已经快 3 年前的项目,我选择将 tensorly 版本降低为 tensorly==0.5.1

ERROR: Could not find a version that satisfies the requirement tensorly==0.5.2 (from versions: 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.2.0, 0.3.0, 0.4.0, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.5.0, 0.5.1, 0.6.0)
ERROR: No matching distribution found for tensorly==0.5.2

pip uninstall tensorly
pip install tensorly==0.5.1

这样就可以解决报错啦,代码能够成功运行得到结果:

tensorly | ImportError: cannot import name ‘check_random_state‘ from ‘tensorly.random‘ 解决方法_报错解决_05

举报

相关推荐

0 条评论