在google colab中导入“pyearth”

dwthyt8l  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(465)

我需要加载一个名为 pyearth 在googlecolab上。这就是我想做的:

  1. # Import model from library
  2. from pyearth import Earth
  3. # Initialize model
  4. reg = Earth()

但是,默认情况下googlecolab没有这个库。当我尝试时,会得到以下错误提示 import pyearth :
modulenotfounderror:没有名为“pyearth”的模块
因此,我尝试使用 !pip ,但是,如下所示,它也不起作用。

  1. # Instal `pyearth`
  2. !pip install pyearth # Runs smoothly
  3. # Import Earth
  4. from pyearth import Earth
  5. > ImportError: cannot import name 'Earth' from 'pyearth' (/usr/local/lib/python3.7/dist-packages/pyearth/__init__.py)

奇怪的是, import pyearth 确实有效。
这篇文章涉及一个非常类似的问题,至今仍未解决。唯一可用的答案对我不起作用。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题