问题
As I'm doing a project for non-english (Sinhala) language I need to sort the words in unicode.
So I followed answer in this question and installed PyICU in a conda environment which I have already installed tensorflow and NLTK.
Now in python console (in Pycharm) when use import icu
and execute the code I'm getting this error.
Traceback (most recent call last):
File "/home/pankaja/PycharmProjects/teamspark/testing/sinhalasort.py", line 1, in <module>
import icu
File "/home/pankaja/anaconda3/envs/tensorflow/lib/python3.5/site-packages/icu/__init__.py", line 37, in <module>
from _icu import *
ImportError: libicui18n.so.58: cannot open shared object file: No such file or directory
Why is that ? Is there any possibility that PyICU
can't be used in a conda environment ?
回答1:
Installing pyicu from the conda-forge channel can be achieved by adding conda-forge to your channels with:
conda config --add channels conda-forge
Once the conda-forge channel has been enabled, pyicu can be installed with:
conda install pyicu
this solves the problem and it will install pyicu with dependencies
回答2:
You need to install libicu. On centos, just run
yum install libicu
来源:https://stackoverflow.com/questions/48365494/pyicu-in-python-3-error-importerror-libicui18n-so-58