我正在尝试运行多语言的基本示例
packagehttp://polyglot.readthedocs.io/en/latest/Installation.html
安装似乎已经有效,但是当我尝试将软件包导入Jupyter笔记本时:
http://polyglot.readthedocs.io/en/latest/Installation.html
import polyglot
from polyglot.text import Text, Word
我收到以下错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-239bcaca06ea> in <module>()
1 import polyglot
----> 2 from polyglot.text import Text, Word
/home/username/anaconda3/lib/python3.6/site-packages/polyglot/text.py in <module>()
7
8 from polyglot.base import Sequence, TextFile, TextFiles
----> 9 from polyglot.detect import Detector, Language
10 from polyglot.decorators import cached_property
11 from polyglot.downloader import Downloader
/home/username/anaconda3/lib/python3.6/site-packages/polyglot/detect/__init__.py in <module>()
----> 1 from .base import Detector, Language
2
3 __all__ = ['Detector', 'Language']
/home/username/anaconda3/lib/python3.6/site-packages/polyglot/detect/base.py in <module>()
9
10
---> 11 from icu import Locale
12 import pycld2 as cld2
13
/home/username/anaconda3/lib/python3.6/site-packages/icu/__init__.py in <module>()
38
39 if sys.version_info >= (3,):
---> 40 from .docs import *
41 else:
42 from docs import *
/home/username/anaconda3/lib/python3.6/site-packages/icu/docs.py in <module>()
21 # ====================================================================
22
---> 23 from _icu import *
24 from _icu import _install__doc__
25
ImportError: /home/username/anaconda3/lib/python3.6/site-packages/_icu.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZTIN6icu_5214LEFontInstanceE
nb:用&#39;用户名&#39;替换了我的实际用户名在上面的片段中。
提前谢谢
答案 0 :(得分:0)
这应该有效
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install polyglot
参考: https://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/