导入sklearn时未定义的符号:_ZTVN10__cxxabiv117__class_type_infoE

时间:2016-06-10 13:40:13

标签: python-2.7 scikit-learn

成功安装/illumina/thirdparty/python/python-2.7.5/bin/pip2.7安装-U scikit-learn后,启动回归分析时出现问题。 from sklearn import linear_model给出了

File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/linear_model/__init__.py", line 25, in <module>
    from .logistic import (LogisticRegression, LogisticRegressionCV,
  File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/linear_model/logistic.py", line 23, in <module>
    from ..svm.base import _fit_liblinear
  File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/svm/__init__.py", line 13, in <module>
    from .classes import SVC, NuSVC, SVR, NuSVR, OneClassSVM, LinearSVC, \
  File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/svm/classes.py", line 4, in <module>
    from .base import _fit_liblinear, BaseSVC, BaseLibSVM
  File "/illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/svm/base.py", line 8, in <module>
    from . import libsvm, liblinear
ImportError: /illumina/thirdparty/python/python-2.7.5/lib/python2.7/site-packages/sklearn/svm/libsvm.so: undefined symbol: _ZTVN10__cxxabiv117__class_type_inf

似乎问题与libsvm一样,因为from sklearn import datasets效果很好。

任何建议都将非常受欢迎。

环境:

  • Python 2.7.5
  • GCC 4.1.2 20080704(Red Hat 4.1.2-44)
  • scipy 0.16.0
  • numpy 1.9.1

2 个答案:

答案 0 :(得分:1)

这显然是ABI不匹配。您可能不自觉地使用链接到本地​​库的python模块,该库应该是不同的版本。确保在运行python时系统只能找到一个libsvm。

答案 1 :(得分:0)

  1. 首先尝试卸载sklearn   apt-get remove sklearn
  2. 删除在包文件夹
  3. 中创建的上一个sklearn目录
  4. 再次安装
    apt-get install python-sklearn