Reputation: 1615
When following the instructions I get the following error message:
Failed building wheel for PyICU
One of the dependencies is missing. However the module PyICU
cannot be installed with homebrew (i.e. brew install PyICU
).
Upvotes: 2
Views: 3094
Reputation: 21
If your ICU version is >= 60.
To successfully install PyICU (polyglot dependency), follow the instructions from bonna's answer and set the PYICU_CFLAGS environment variable required by the C++ compiler.
export PYICU_CFLAGS=-std=c++11:-DPYICU_VER='"2.0.3"'
See Unable to install pyicu on MacOS
Upvotes: 1
Reputation: 1379
Go in you working folder
cd ~/projects/pythontest
brew install python3.7
pip3 install virtualenv
virtualenv --python=/usr/local/bin/python3 python_env
brew install intltool icu4c gettext
brew link icu4c gettext --force
create shorcut for pip3, python3 and polyglot as we will use them a lot
pip3=./python_env/bin/pip3; polyglot=./python_env/bin/polyglot;python3=./python_env/bin/python3;
if you have already installed pyicu it is important to delete it
$pip3 uninstall pyicu
Install pyicu and replace with the good version
ICU_VERSION=64.2 CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib $pip3 install pyicu
$pip3 install pycld2 morfessor six numpy polyglot
create a filepolytest.py
from polyglot.text import Text
blob = u"""
世界就是一个疯子的囚笼
"""
text = Text(blob)
print(text.words)
And run the file
$python3 polytest.py
Upvotes: 1
Reputation: 1615
You can use icu4c
instead of PyICU
.
Follow these steps: https://stackoverflow.com/a/33352241/1053612
(May require installing python between steps 1 and 2, i.e. brew install python
).
Upvotes: 0