【问题标题】:Unable to install pyicu on MacOS无法在 MacOS 上安装 pyicu
【发布时间】:2018-05-06 19:17:08
【问题描述】:

我尝试通过pip3 install pyicu 安装并收到以下错误:

Collecting pyicu
Using cached https://files.pythonhosted.org/packages/bb/ef/3a7fcbba81bfd213e479131ae21445a2ddd14b46d70ef0109640b580bc5d/PyICU-2.0.3.tar.gz

Complete output from command python setup.py egg_info:

Building PyICU 2.0.3 for ICU 61

Could not configure CXXFLAGS with icu-config
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/80/v1nwf70x2rz5srmzfnpc3pq40000gn/T/pip-build-b_sify1x/pyicu/setup.py", line 131, in <module>
    _cflags, ('--cxxflags', '--cppflags'), 'CXXFLAGS')
  File "/private/var/folders/80/v1nwf70x2rz5srmzfnpc3pq40000gn/T/pip-build-b_sify1x/pyicu/setup.py", line 30, in configure_with_icu_config
    output = check_output(('icu-config',) + config_args).strip()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 403, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1326, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'icu-config'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/80/v1nwf70x2rz5srmzfnpc3pq40000gn/T/pip-build-b_sify1x/pyicu/

然后从某些来源我知道我需要为 icu 安装 icu4c 并通过 .bash_profile 进行配置。也尝试过这样做,但错误仍然存​​在。请帮帮我。

【问题讨论】:

  • 尝试在命令行中运行:export PYICU_CFLAGS=-std=c++11:-DPYICU_VER='"2.0.3"'
  • 它终于奏效了。搜索了整个互联网并且无法做到这一点,但是您用一行命令解决了它。伟大的!谢谢@Bilzard
  • 请将我的答案设置为已接受的答案,以便其他人知道问题的解决方案!

标签: python pyicu


【解决方案1】:

尝试在命令行中运行:

export PYICU_CFLAGS=-std=c++11:-DPYICU_VER='"2.0.3"'

【讨论】:

    猜你喜欢
    • 2021-09-21
    • 2015-11-05
    • 2017-04-21
    • 2021-12-28
    • 2020-02-26
    • 2021-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多