sklearn_extra 安装问题

sklearn_extra installation issue

[在]:

from sklearn_extra.cluster import KMedoids

[输出]:

ModuleNotFoundError: No module named 'sklearn_extra'

然后,我尝试通过

安装sklearn_extra

[在]:

python -m pip install sklearn_extra

[输出]:

ERROR: Could not find a version that satisfies the requirement sklearn_extra (from versions: none)
ERROR: No matching distribution found for sklearn_extra

然后,我去了网站的安装部分(https://scikit-learn-extra.readthedocs.io/en/latest/install.html)并按照它说的做了:

Installation
Dependencies
scikit-learn-extra requires,

Python (>=3.5)

scikit-learn (>=0.21), and its dependencies

Cython (>0.28)

User installation
Latest development version can be installed with,

pip install https://github.com/scikit-learn-contrib/scikit-learn-extra/archive/master.zip

[在]:

pip install https://github.com/scikit-learn-contrib/scikit-learn-extra/archive/master.zip

[输出]:

  ERROR: Command errored out with exit status 1:
   command: 'c:\users\m\appdata\local\programs\python\python37\python.exe' 'c:\users\m\appdata\local\programs\python\python37\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\m\AppData\Local\Temp\pip-build-env-yopprv13\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'cython>=0.28' numpy==1.14.5
       cwd: None
  Complete output (14 lines):
  Traceback (most recent call last):
    File "c:\users\m\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
      "__main__", mod_spec)
    File "c:\users\m\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
      exec(code, run_globals)
    File "c:\users\m\appdata\local\programs\python\python37\lib\site-packages\pip\__main__.py", line 16, in <module>
      from pip._internal.main import main as _main  # isort:skip # noqa
    File "c:\users\m\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\main.py", line 8, in <module>
      import locale
    File "c:\users\m\appdata\local\programs\python\python37\lib\locale.py", line 16, in <module>
      import re
    File "c:\users\m\appdata\local\programs\python\python37\lib\re.py", line 143, in <module>
      class RegexFlag(enum.IntFlag):
  AttributeError: module 'enum' has no attribute 'IntFlag'

我检查了 Cython、Python 和 sklearn 的版本,它们满足要求的范围。

编辑:由于 Balraj Ashwatt 的评论,解决方案是为我卸载 enum34。

pip uninstall -y enum34

然后我就可以安装了sklearn_extra

我试过了,

pip install scikit-learn-extra

这似乎对我有用 !

卸载 enum34 对我有用,然后我能够安装 sklearn_extra

pip uninstall -y enum34

试试这个命令:

conda install -c conda-forge scikit-learn-extra