Alp*_*ine 8 python scikit-learn
我正在尝试导入sklearn,但是当我尝试导入时,会收到以下消息:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-8fd979e02004> in <module>()
----> 1 import sklearn
C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__init__.py in <module>()
29 # process, as it may not be compiled yet
30 else:
---> 31 from . import __check_build
32 from .base import clone
33
C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__check_build\__init__.py in <module>()
44 from ._check_build import check_build
45 except ImportError as e:
---> 46 raise_build_error(e)
C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__check_build\__init__.py in raise_build_error(e)
39 to build the package before using it: run `python setup.py install` or
40 `make` in the source directory.
---> 41 %s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
42
43 try:
ImportError: No module named _check_build
___________________________________________________________________________
Contents of C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__check_build:
setup.py setup.pyc _check_build.c
_check_build.pyx __init__.py __init__.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.
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line string', (1, 2))
Run Code Online (Sandbox Code Playgroud)
我相当确定scikit-learn 已正确构建,因为我设法python setup.py install没有任何意外地运行。但是我确实尝试过跑步,python setup.py bdist_wininst -b doc/logos/scikit-learn-logo.bmp尽管在中断了error: cannot copy tree 'build\scripts.win-amd64-2.7': not a directory。
可能有人对如何解决此问题有想法吗?
我在 Windows 10 上遇到了同样的问题。我用 Python 3.7 安装了 Anaconda,并且这个安装不仅带来了这个问题。要解决在 anaconda 提示符下运行:
conda install scikit-learn
Run Code Online (Sandbox Code Playgroud)
至少这对我有用
好的,以下对我来说是工作:)
sudo make
sudo python setup.py install
Run Code Online (Sandbox Code Playgroud)
最后测试一下安装是否ok:
nosetests --exe sklearn
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15124 次 |
| 最近记录: |