【问题标题】:How to fix Google colab import errors on statsmodels logsumexp and factorial如何修复 statsmodels logsumexp 和 factorial 上的 Google colab 导入错误
【发布时间】:2019-05-22 09:15:57
【问题描述】:

在 statsmodels 包(如 logsumexp 和 factorial)上的 google collab Jupyter notebook 中出现导入错误。

请提出建议。

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 的运行时。但是,导入仍然存在。

【问题讨论】:

    标签: jupyter-notebook google-colaboratory python-3.3


    【解决方案1】:

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

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

    从以下链接获取:This issue is solved temporarily

    【讨论】:

      【解决方案2】:

      我正在研究 google colab。然后我遇到了同样的问题“无法导入名称:factorial”。实际上它来自scipy

      适用于窗户

      pip3 install --user scipy==1.2.0
      

      适用于 Linux

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

      【讨论】:

        【解决方案3】:

        改变

        从 scipy.misc 导入阶乘

        从 scipy.special 导入阶乘

        在几个地方(到处都有错误消息) 与

        相同

        梳,logsumexp

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2021-10-12
          • 2023-01-10
          • 2022-08-20
          • 2021-03-30
          • 2016-06-22
          • 2022-12-22
          • 2021-03-30
          • 2021-12-20
          相关资源
          最近更新 更多