安装 pip pyicu 出错

新手上路,请多包涵

我一直在尝试在我的 mac 上安装 musicbrainz 服务器,并且有一个步骤我必须安装 pip pyicu。我不断收到此错误:

 Collecting pyicu
Downloading PyICU-1.9.5.tar.gz (181kB)
100% |████████████████████████████████| 184kB 515kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/tmp/pip-build-E50o2C/pyicu/setup.py", line 11, in <module>
    ICU_VERSION = subprocess.check_output(('icu-config', '--version')).strip()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-E50o2C/pyicu/

我试过下载 ez_setup.py 并执行 python ez_setup.py。我已经升级了 setuptools 并单独下载了它们。我不确定还有什么可以尝试的。请帮忙!

原文由 Eric Agredo 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.3k
2 个回答

尝试安装多语言时,我在我的 Mac 上遇到了这个问题(多语言需要 pyicu)。以下为我解决了这个问题。

 # Install icu
brew install icu4c

# check newest version
ls /usr/local/Cellar/icu4c/

# Edit pyicu installer to work
git clone https://github.com/ovalhub/pyicu.git

# edit setup.py not to query for the version, i.e. change
# ICU_VERSION = subprocess.check_output(('icu-config', '--version')).strip()
# to whatever your version is, e.g.
# ICU_VERSION = '57.1'

# Install pyicu
env LDFLAGS=-L/usr/local/opt/icu4c/lib CPPFLAGS=-I/usr/local/opt/icu4c/include DYLD_LIBRARY_PATH=-L/usr/local/opt/icu4c/lib python setup.py build
env LDFLAGS=-L/usr/local/opt/icu4c/lib CPPFLAGS=-I/usr/local/opt/icu4c/include DYLD_LIBRARY_PATH=-L/usr/local/opt/icu4c/lib sudo python setup.py install

# Change DYLD_LIBRARY_PATH (not sure if req'd)
DYLD_LIBRARY_PATH=/usr/local/Cellar/icu4c/{version, e.g. 57.1}/:$DYLD_LIBRARY_PATH
echo $DYLD_LIBRARY_PATH

# Icu works now from python, and you can proceed with polyglot
$ python
>>> import icu
$ pip install polyglot
$ python
>>> import polyglot

原文由 ppt 发布,翻译遵循 CC BY-SA 3.0 许可协议

我在 ubuntu 14.04 和 16.04 上遇到过这个问题。要解决此问题,请安装 libicu-dev,然后再次尝试安装。我做了

$sudo apt install libicu-dev
$pip install pyicu

原文由 MUNGAI NJOROGE 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题