-2

I get an error when importing sklearn in python.

I am using MacBook.

>>> import sklearn

Error:

> Traceback (most recent call last):   File
> "<pyshell#1>", line 1, in <module>
>     import sklearn   File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sklearn/__init__.py",
> line 81, in <module>
>     from . import __check_build  # noqa: F401 ImportError: cannot import name '__check_build' from 'sklearn'
> (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sklearn/__init__.py)
Noki
  • 870
  • 10
  • 22
NeePew
  • 1
  • 1

2 Answers2

1

According to the pypi page for sklearn, you should be using pip install scikit-learn instead of pip install sklearn

scign
  • 812
  • 5
  • 15
0

Your requirements.txt file needs the line

scikit-learn==0.22.1

or, if you're not storing requirements for the project, then

pip install scikit-learn

on the command line.

wogsland
  • 9,106
  • 19
  • 57
  • 93