2016-12-06 24 views
1

我想根據這個鏈接,在Mac上的Python 3.5安裝pyicu https://struggley.wordpress.com/2015/07/14/installation-pyicu-on-mac-osx-yosemite/不能因「ICU-配置」

然而,當我EXCUTE PIP3安裝pyicu安裝pyicu,我得到這個錯誤

Collecting pyicu 
Using cached PyICU-1.9.5.tar.gz 
Complete output from command python setup.py egg_info: 
Traceback (most recent call last): 
    File "<string>", line 1, in <module> 
    File "/private/var/folders/70/jlxmpp0n003805pmw6tfc0r80000gn/T/pip-build-7eusuic1/pyicu/setup.py", line 11, in <module> 
    ICU_VERSION = subprocess.check_output(('icu-config', '--version')).strip() 
    File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 626, in check_output 
    **kwargs).stdout 
    File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 693, in run 
    with Popen(*popenargs, **kwargs) as process: 
    File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__ 
    restore_signals, start_new_session) 
    File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child 
    raise child_exception_type(errno_num, err_msg) 
FileNotFoundError: [Errno 2] No such file or directory: 'icu-config' 

我想這是因爲我沒有正確設置icu-config的路徑。我認爲以下兩個可能是icu-config文件。

/usr/local/Cellar/icu4c/58.1/bin/icu-config 
/usr/local/Cellar/icu4c/58.1/share/man/man1/icu-config.1 

但是,我不知道如何設置它的路徑。此外,我不知道爲什麼我在教程可以順利運行時遇到此錯誤。

回答

9

我有同樣的問題。這爲我工作

brew install intltool icu4c gettext 
brew link icu4c gettext --force 
CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip3 install pyicu 

來源:https://github.com/Homebrew/legacy-homebrew/issues/34170

+1

酷!我以前沒有安裝gettext。但是在我安裝gettext後,你的方法神奇地工作。謝謝。 – Chenlu

+0

順便說一下,因爲我使用的是Anaconda python 3.5,所以我使用pip安裝,而不是pip3安裝。 – Chenlu