我使用brew install icu4c
withpip install pyicu
来安装 python ICU 支持,但最后我无法在我的 Mountain Lion 上工作。
$ brew install icu4c
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
==> Downloading http://download.icu-project.org/files/icu4c/50.1/icu4c-50_1-src.tgz
Already downloaded: /Library/Caches/Homebrew/icu4c-50.1.tgz
==> ./configure --prefix=/usr/local/Cellar/icu4c/50.1 --disable-samples --disable-tests --enable-static --with-library-bits=64
==> make
==> make install
/usr/local/Cellar/icu4c/50.1: 235 files, 55M, built in 109 seconds
$ pip install pyicu
Downloading/unpacking pyicu
Downloading PyICU-1.4.tar.gz (209kB): 209kB downloaded
Running setup.py egg_info for package pyicu
Installing collected packages: pyicu
Running setup.py install for pyicu
building '_icu' extension
/usr/bin/clang -fno-strict-aliasing -Os -w -pipe -march=native -Qunused-arguments -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c _icu.cpp -o build/temp.macosx-10.4-x86_64-2.7/_icu.o -Wno-write-strings -DPYICU_VER="1.4"
…
/usr/bin/clang++ -bundle -undefined dynamic_lookup -L/usr/local/Cellar/readline/6.2.2/lib build/temp.macosx-10.4-x86_64-2.7/_icu.o build/temp.macosx-10.4-x86_64-2.7/bases.o build/temp.macosx-10.4-x86_64-2.7/calendar.o build/temp.macosx-10.4-x86_64-2.7/charset.o build/temp.macosx-10.4-x86_64-2.7/collator.o build/temp.macosx-10.4-x86_64-2.7/common.o build/temp.macosx-10.4-x86_64-2.7/dateformat.o build/temp.macosx-10.4-x86_64-2.7/errors.o build/temp.macosx-10.4-x86_64-2.7/format.o build/temp.macosx-10.4-x86_64-2.7/iterators.o build/temp.macosx-10.4-x86_64-2.7/layoutengine.o build/temp.macosx-10.4-x86_64-2.7/locale.o build/temp.macosx-10.4-x86_64-2.7/normalizer.o build/temp.macosx-10.4-x86_64-2.7/numberformat.o build/temp.macosx-10.4-x86_64-2.7/regex.o build/temp.macosx-10.4-x86_64-2.7/search.o build/temp.macosx-10.4-x86_64-2.7/transliterator.o build/temp.macosx-10.4-x86_64-2.7/tzinfo.o build/temp.macosx-10.4-x86_64-2.7/unicodeset.o -licui18n -licuuc -licudata -licule -o build/lib.macosx-10.4-x86_64-2.7/_icu.so -L/usr/local/lib
Successfully installed pyicu
Cleaning up...
这是安装了 Xcode 4.5 和 46.DP2 的 Mountain Lion 设置。
$ python
Python 2.7.3 (default, Jun 14 2012, 00:46:15)
[GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.61)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import icu
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/icu.py", line 37, in <module>
from docs import *
File "/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/docs.py", line 23, in <module>
from _icu import *
ImportError: dlopen(/usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/_icu.so, 2): Symbol not found: __ZNK6icu_5014LEFontInstance10getSubFontEPKtPiiiR11LEErrorCode
Referenced from: /usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/_icu.so
Expected in: dynamic lookup
>>>
$ otool -L _icu.so
_icu.so:
/usr/local/lib/libicui18n.50.1.dylib (compatibility version 50.0.0, current version 50.1.0)
/usr/local/lib/libicuuc.50.1.dylib (compatibility version 50.0.0, current version 50.1.0)
/usr/local/lib/libicudata.50.1.dylib (compatibility version 50.0.0, current version 50.1.0)
/usr/local/lib/libicule.50.1.dylib (compatibility version 50.0.0, current version 50.1.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1669.0.0)
有人遇到同样的问题吗?我还能尝试什么?
更多信息 /usr/local/bin/python:Mach-O 64 位可执行 x86_64 /usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages/_icu.so:Mach-O 64 -位捆绑 x86_64