2017-08-01

Error installing polyglot in Python 3

Chuyển code từ Python 2.7 sang 3.x

Gặp lỗi dạng như sau:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 4941: character maps to 

https://stackoverflow.com/questions/41746072/error-installing-polyglot-in-python-3-5-2
https://github.com/aboSamoor/polyglot/issues/93

Nếu chưa cài những packages sau thì cài trước pycld2, PyICU, numpy
Trên Windows download tại http://www.lfd.uci.edu/~gohlke/pythonlibs
pycld2-0.31-cp36-cp36m-win32.whl
PyICU-1.9.7-cp36-cp36m-win32.whl
numpy-1.13.1+mkl-cp36-cp36m-win32.whl

Thực hiện download source từ Github
https://github.com/aboSamoor/polyglot/archive/master.zip
https://codeload.github.com/aboSamoor/polyglot/zip/master

Unzip và chạy tại folder và install bằng source thay vì dùng pip:
python setup.py install

Install một số libraries khác trên Windows.

Install libxml2, libxslt:
pip install lxml

Install SQLAlchemy:
pip install SQLAlchemy