如何修复 statsmodels logsumexp 和 factorial 上的 Google colab 导入错误

How to fix Google colab import errors on statsmodels logsumexp and factorial

我在 google collab Jupyter notebook 中的 statsmodels 包(例如 logsumexp 和 factorial)中遇到导入错误。

请推荐。

from scipy.misc import logsumexp
from scipy.misc import factorial 
ImportError: cannot import name 'logsumexp'
ImportError: cannot import name 'factorial'

我已经重新安装了 scipy 和 sci-kit 并重新启动了 google collab jupyter notebook 的运行时。但是,导入仍然存在。

在 colabs 中寻找类似的问题并执行了以下操作:

! pip install --upgrade Cython
! pip install --upgrade git+https://github.com/statsmodels/statsmodels
import statsmodels.api as sm

从下面得到它 link: This issue is solved temporarily

我正在研究 google colab。然后我遇到了同样的问题 "can not import name :factorial"。实际上它来自 scipy

为windows

pip3 install --user scipy==1.2.0

对于Linux

python3.6 -m pip install scipy==1.2 --upgrade

改变

from scipy.misc import factorial

from scipy.special import factorial

在几个地方(到处都是你收到错误信息的地方) 与

相同

comb, logsumexp