在 continuumio/miniconda3:4.9.2 镜像上安装 PyICU

问题描述

不幸的是,在使用 Docker 基础时:continuumio/miniconda3:4.9.2 来自 https://hub.docker.com/r/continuumio/miniconda3 并运行: pip install PyICU==2.4.2 我收到此错误

------                                                                                                                      
 > [ 5/10] RUN pip install PyICU==2.4.2:                                                                                    
#9 0.864 Collecting PyICU==2.4.2                                                                                            
#9 2.275   Downloading PyICU-2.4.2.tar.gz (219 kB)                                                                          
#9 3.115     ERROR: Command errored out with exit status 1:                                                                 
#9 3.115      command: /opt/conda/bin/python -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k004hem9/pyicu/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k004hem9/pyicu/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-bze17p9f
#9 3.115          cwd: /tmp/pip-install-k004hem9/pyicu/
#9 3.115     Complete output (53 lines):
#9 3.115     Package icu-i18n was not found in the pkg-config search path.
#9 3.115     Perhaps you should add the directory containing `icu-i18n.pc'
#9 3.115     to the PKG_CONfig_PATH environment variable
#9 3.115     No package 'icu-i18n' found
#9 3.115     Traceback (most recent call last):
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py",line 62,in <module>
#9 3.115         ICU_VERSION = os.environ['ICU_VERSION']
#9 3.115       File "/opt/conda/lib/python3.8/os.py",line 675,in __getitem__
#9 3.115         raise KeyError(key) from None
#9 3.115     KeyError: 'ICU_VERSION'
#9 3.115     
#9 3.115     During handling of the above exception,another exception occurred:
#9 3.115     
#9 3.115     Traceback (most recent call last):
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py",line 65,in <module>
#9 3.115         ICU_VERSION = check_output(('icu-config','--version')).strip()
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py",line 18,in check_output
#9 3.115         return subprocess_check_output(popenargs)
#9 3.115       File "/opt/conda/lib/python3.8/subprocess.py",line 411,in check_output
#9 3.115         return run(*popenargs,stdout=PIPE,timeout=timeout,check=True,#9 3.115       File "/opt/conda/lib/python3.8/subprocess.py",line 489,in run
#9 3.115         with Popen(*popenargs,**kwargs) as process:
#9 3.115       File "/opt/conda/lib/python3.8/subprocess.py",line 854,in __init__
#9 3.115         self._execute_child(args,executable,preexec_fn,close_fds,line 1702,in _execute_child
#9 3.115         raise child_exception_type(errno_num,err_msg,err_filename)
#9 3.115     FileNotFoundError: [Errno 2] No such file or directory: 'icu-config'
#9 3.115     
#9 3.115     During handling of the above exception,line 68,in <module>
#9 3.115         ICU_VERSION = check_output(('pkg-config','--modversion','icu-i18n')).strip()
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py",line 512,in run
#9 3.115         raise CalledProcessError(retcode,process.args,#9 3.115     subprocess.CalledProcessError: Command '('pkg-config','icu-i18n')' returned non-zero exit status 1.
#9 3.115     
#9 3.115     During handling of the above exception,another exception occurred:
#9 3.115     
#9 3.115     Traceback (most recent call last):
#9 3.115       File "<string>",line 1,in <module>
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py",line 70,in <module>
#9 3.115         raise RuntimeError('''
#9 3.115     RuntimeError:
#9 3.115     Please install pkg-config on your system or set the ICU_VERSION environment
#9 3.115     variable to the version of ICU you have installed.
#9 3.115     
#9 3.115     (running 'icu-config --version')
#9 3.115     (running 'pkg-config --modversion icu-i18n')
#9 3.115     ----------------------------------------
#9 3.115 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我也尝试过安装这些软件包,但没有成功:

RUN apt-get update
RUN apt-get install -y sudo build-essential pkg-config gcc awscli jq vim 

有谁知道我缺少什么配置/我需要添加什么包?

解决方法

PyICU 是围绕 C++ ICU 库的 Python 包装器。您需要先安装上述库:

apt-get install libicu-dev

另见https://gitlab.pyicu.org/main/pyicu#installing-pyicu

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...