因此,我能够为python2安装sklearn,但由于某些原因,我对python3也有问题。我得到了这个错误:
Traceback (most recent call last):
File "/home/ajshack_pg/sklearn/__check_build/__init__.py", line 44, in <module>
from ._check_build import check_build # noqa
ImportError: /home/ajshack_pg/sklearn/__check_build/_check_build.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ajshack_pg/sklearn/__init__.py", line 133, in <module>
from . import __check_build
File "/home/ajshack_pg/sklearn/__check_build/__init__.py", line 46, in <module>
raise_build_error(e)
File "/home/ajshack_pg/sklearn/__check_build/__init__.py", line 41, in raise_build_error
%s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
ImportError: /home/ajshack_pg/sklearn/__check_build/_check_build.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8
___________________________________________________________________________
Contents of /home/ajshack_pg/sklearn/__check_build:
setup.py setup.pyc __init__.pyc
_check_build.so __init__.py
___________________________________________________________________________
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.我试着进入源目录,输入他们说的话,但没有结果。这里有洞察力吗?
谢谢!
发布于 2018-01-01 03:24:27
如果您从Python2.x的源代码中安装了sklearn,如果您没有完全删除所有sklearn文件,它的一些二进制文件可能会持续存在。Python2.x和3.x非常不兼容,所以这可能是它无法构建的原因之一。
需要采取的几个步骤:
virtualenv -p python3 envnamenumpy和scipy之后的pip install -U scikit-learn。https://stackoverflow.com/questions/48046646
复制相似问题