Domanda

Hi i have installed the Scikit-learn but i keep getting error msgs when i try to import the sklearn module. it shows the following msg. anyone knows what's going on?

import sklearn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sklearn/__init__.py", line 31, in <module>
    from . import __check_build
  File "sklearn/__check_build/__init__.py", line 46, in <module>
    raise_build_error(e)
  File "sklearn/__check_build/__init__.py", line 41, in raise_build_error
    %s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
ImportError: No module named _check_build
___________________________________________________________________________
Contents of sklearn/__check_build:
__init__.py               __init__.pyc              _check_build.c
_check_build.pyx          setup.py                  setup.pyc
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.

If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.

If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.
È stato utile?

Soluzione

As you can see in your errors: ImportError: No module named _check_build in that directory it has .c file and it never compiled.

If you check this link you will see many parts of scikit-learn has been written in C.

So for installing this kind of packages , you need to install python-dev package in your system.

python-dev package will install many C headers like python.h.

So install python-dev package in your system and then remove and install scikit-learn package again.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top