在虚拟环境中安装python Polyglot包时出现的问题

时间:2017-09-28 11:16:54

标签: python python-3.x virtualenv polyglot

我正在尝试在Mac上的虚拟环境中安装多个软件包(OS X El Capitan 10.11.6)。我已经成功安装了polyglot(版本16.7.4)。一切正常,直到我推出Python(版本3.6)。

这是我尝试从多语言导入文本时得到的结果。

>>> import polyglot
>>> from polyglot import text
sh: grep: command not found
sh: sysctl: command not found
sh: sw_vers: command not found
sh: grep: command not found
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<WORKING DIRECTORY>/lib/python3.6/site-packages/polyglot/text.py", line 9, in <module>
from polyglot.detect import Detector, Language
  File "<WORKING DIRECTORY>/lib/python3.6/site-packages/polyglot/detect/__init__.py", line 1, in <module>
from .base import Detector, Language
  File "<WORKING DIRECTORY>/lib/python3.6/site-packages/polyglot/detect/base.py", line 11, in <module>
from icu import Locale
ModuleNotFoundError: No module named 'icu'
>>> 

为了创建虚拟环境,我将venv模块作为带有目录路径的脚本运行。

知道该怎么做?

1 个答案:

答案 0 :(得分:3)

polyglot的作者忘记在setup.py中列出requirements,因此pip install polyglot不会自动安装它们。请将错误报告给问题跟踪器。

同时下载多语言源并运行

pip install -r requirements.txt