17
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[エラー] Symbol not found: _PyUnicodeUCS2_Compare

Last updated at Posted at 2016-04-03

環境

  • OSX 10.11.4 ( El Capitan )
  • python 2.7.11

エラー

scikit-learnとかgensim使おうとimportしたらエラーが出た。

File "test.py", line 6, in <module>
    from sklearn.feature_extraction.text import CountVectorizer
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/sklearn/base.py", line 9, in <module>
    from scipy import sparse
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/__init__.py", line 216, in <module>
    from .lil import *
  File "/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/lil.py", line 16, in <module>
    from . import _csparsetools
ImportError: dlopen(/usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/_csparsetools.so, 2): Symbol not found: _PyUnicodeUCS2_Compare
  Referenced from: /usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/_csparsetools.so
  Expected in: flat namespace
 in /usr/local/var/pyenv/versions/2.7.11/lib/python2.7/site-packages/scipy/sparse/_csparsetools.so

解決

(2016/4/3追記) shuhei_f 様のコメント

一度pyenv uninstall 2.7.11として pyenv で入れた Python を消してから PYTHON_CONFIGURE_OPTS="--enable-unicode=ucs2" pyenv install 2.7.11 とオプションを付けてインストールし直すと正常に動くかもしれません。

で解決した!

とはいえ原因はわからずじまいで気持ち悪いので、しばらくしたらpython入れなおそうかなあ。

17
18
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?