-
Notifications
You must be signed in to change notification settings - Fork 287
Description
ผมใช้ mac osx โดยใช้ python 3.6 ที่ติดมากับ anaconda ครับ แล้วลงตามที่เขียนไว้ตามคำแนะนำหลังจากนั้นก็ลองใช้โค๊ดตัวอย่างดูแล้วขึ้น error ตามนี้ครับ
>>> from pythainlp.tokenize import word_tokenize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/arsapol/anaconda3/lib/python3.6/site-packages/pythainlp/__init__.py", line 10, in <module>
from pythainlp.romanization import *
File "/Users/arsapol/anaconda3/lib/python3.6/site-packages/pythainlp/romanization/__init__.py", line 3, in <module>
import icu
File "/Users/arsapol/anaconda3/lib/python3.6/site-packages/icu/__init__.py", line 40, in <module>
from .docs import *
File "/Users/arsapol/anaconda3/lib/python3.6/site-packages/icu/docs.py", line 23, in <module>
from _icu import *
ImportError: dlopen(/Users/arsapol/anaconda3/lib/python3.6/site-packages/_icu.cpython-36m-darwin.so, 2): Library not loaded: libicui18n.54.dylib
Referenced from: /Users/arsapol/anaconda3/lib/python3.6/site-packages/_icu.cpython-36m-darwin.so
Reason: image not found
Edit : แก้ไขได้แล้วครับ แก้ตามลิ้งค์นี้ครับ
@BradyHammond @robooo , I have a solution for all of us; On 11 Dec 2016, successfully installed polyglot on my Mac computer with Anaconda. My specs:
macOS Sierra version 10.12.1
Anaconda, conda version 4.2.13
execute conda --version in terminal to see your version
Installed from here: https://repo.continuum.io/archive/Anaconda3-4.2.0-MacOSX-x86_64.sh
Python version 3.5.2 (see this Gist to get Polyglot working in Python 2.7)
I made a Github Gist that automatically installs Polyglot on a Mac Computer running Anaconda. To run my gist just cut and paste this:wget https://gist.githubusercontent.com/linwoodc3/8704bbf6d1c6130dda02bbc28967a9e6/raw/91d8e579c0fa66399ab1959c9aa94ea09c3eb539/polyglotOnMacOSX.sh -O polyglotOnMacOSX.sh && bash polyglotOnMacOSX.sh
I will also list the exact steps, but first, here are some important notes:Key Facts/Problem Areas
So far, this only works with Python 3.5
My GitHub Gist has a fix for Python 2.7, but it's more involved. Will try to create pyicu merge request
Must use easy_install pyicu and not pip install pyicu
installing pyicu with pip install pyicu always leads to Library not loaded... error
I believe this has something to do with easy_install using a Python egg for install; have to research difference between pip and easy_install
Must use conda install -c ccordoba12 icu=54.1
Found at https://anaconda.org/ccordoba12/icu
ensure that you have icu 54.1.1 and not icu 58.1 or icu 54.1.0. Just using conda install icu will not work!!
The biggest problem is that brew install icu4c uses version 58.1
Uses wrong version as you can see here: http://brewformulas.org/Icu4c. We need version 54.1 based on the output of each of our errors:
Library not loaded: libicui18n.54.dylib
Again, you can use my Github Gist to automatically test this on your machine. If you want to manually try the steps, they areExact Steps I used (tested several times)
First, started from clean version of Anaconda, HomeBrew, etc. This is optional but it worked for me:
brew uninstall --force icu4c
brew update
find $(brew --cache) -mindepth 1 -print -delete
Fresh install of anaconda :
- rm -rf anaconda # removes existing Anaconda install
Command Line Installer for Python 3 OS X downloaded on 11 Dec 2016 from: https://repo.continuum.io/archive/Anaconda3-4.2.0-MacOSX-x86_64.shNow the steps after Anaconda is installed:
conda create -n icutest requests --no-deps -y
source activate icutest
conda install -c ccordoba12 icu=54.1
https://anaconda.org/ccordoba12/icu
conda install ipython jupyter notebook
ipython
!easy_install pyicu
exit
pip install polyglot
ipython
from polyglot.text import Text, Word
Or, you can use my gist to automatically test the install:wget https://gist.githubusercontent.com/linwoodc3/8704bbf6d1c6130dda02bbc28967a9e6/raw/91d8e579c0fa66399ab1959c9aa94ea09c3eb539/polyglotOnMacOSX.sh -O polyglotOnMacOSX.sh && bash polyglotOnMacOSX.sh