安装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,并分别下载了这些设备。我不确定还有什么要尝试。请帮助!

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

$sudo apt install libicu-dev
$pip install pyicu

我在尝试安装polyglot时在Mac上遇到此问题(Polyglot需要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

让我获得它的工作:

1)与酿造一起安装icu4c

brew install icu4c
brew link icu4c --force

2)检查版本:

ls /usr/local/Cellar/icu4c/

它提示了类似的东西: 64.2

3)从上一步中替换正确版本的鲍洛命令(仅第一行整数部分,第二行和第三行,十进制零件):

export ICU_VERSION=64
export PYICU_INCLUDES=/usr/local/Cellar/icu4c/64.2/include
export PYICU_LFLAGS=-L/usr/local/Cellar/icu4c/64.2/lib

4)终于为pyicu安装Python软件包:

pip install pyicu --upgrade

如果您因上述失败(在OS X 10.15上已经发生在我身上),则可能需要:

brew install pkg-config
export PYICU_CFLAGS=-std=c++11:-DPYICU_VER='"2.3.1"'

在macOS 10.14.2上只需将包含 icu-config的目录添加到 PATH中为我做到了困难:

brew install icu4c
export PATH="/usr/local/opt/icu4c/bin:$PATH"
pip install pyicu

实际上,这是由brew info icu4c提出的:

==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"
For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

下面的解决方案仅适用于Mac OSX-

尝试使用啤酒安装PYICU:

brew install icu4c

如果说它已经安装了并且需要链接,请尝试以下操作:

brew link icu4c

此创建"/usr/local/cellar/icu4c/..."

中的相对符号链接

以下解决方案在OSX上为我工作:

# Install ucu4c via Brew
brew install icu4c
# Create relative symlinks for icu4c
brew link --force icu4c
# Install pyicu via pip
# Make sure ICU_VERSION matches the one you just installed
sudo ICU_VERSION=60.2 pip install pyicu

似乎brew打包的icu4c的当前版本无法正确链接icu-config文件。

运行brew link icu4c --force为您提供了必要的信息来解决此问题,但无法自动链接它。

$ brew link --force icu4c
Warning: Refusing to link macOS-provided software: icu4c
If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile
For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"
For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

通过brew安装icu4c后,您需要运行以下内容,以将icu-config进入路径(假设您正在运行bash作为外壳):

echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

之后,您应该能够安装pyicu而无需任何其他环境变量:

$ pip install --no-cache-dir pyicu
Collecting pyicu
  Downloading https://files.pythonhosted.org/packages/c2/15/0af20b540c828943b6ffea5677c86e908dcac108813b522adebb75c827c1/PyICU-2.2.tar.gz (211kB)
    100% |████████████████████████████████| 215kB 4.9MB/s 
Installing collected packages: pyicu
  Running setup.py install for pyicu ... done
Successfully installed pyicu-2.2

总而言之,这是我运行的命令的完整列表:

brew install icu4c
brew link icu4c --force
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
pip install --no-cache-dir pyicu

(顺便说一句,我遇到的许多解决方案都没有使用pip install使用--no-cache-dir选项。我认为其中一些可能具有pyicu的构建版本。我做了一段时间,掩盖了问题。't直到我尝试了能够复制并适当修复的选项。)

这会失败,因为icu4c是仅在brew info icu4c的警告部分中看到的纯公式。

其他一些答案建议使用brew link icu4c,但这可能会导致其他问题,因为MacOS已经提供libicucore.dylib

pip install pyicu失败,因为

  • 将尝试运行icu-config命令,因此icu-config必须在路径中
  • 将尝试运行pkgconfig ... icu-i18n,因此ICU4C的.pc文件必须在PKG_CONFIG_PATH

对于MacOS,如果您不想brew link icu4c,并且只想将ICU4C用于您的pip install命令,则可以做到这一点:

brew install pkg-config icu4c
# brew info icu4c 
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
icu-config --version # 68.2
pkg-config --modversion icu-i18n # 68.2
pip install pyicu==2.6.0 # works because icu-config in PATH and pkgconfig can find icu4c

我试图在RHEL中安装,然后我从tar.gz文件安装。以下是命令:

    /usr/local/bin/pip3 install -U setuptools
    /usr/local/bin/pip3 install -U wheel
    wget http://download.icu-project.org/files/icu4c/50.1.2/icu4c-50_1_2-src.tgz
    tar -zxvf icu4c-50_1_2-src.tgz
    cd icu
    cd source
    sudo ./configure --prefix=/usr
    sudo make
    sudo make install
    icu-config --version
    /usr/local/bin/pip3 install PyICU==2.0.6

相关内容

  • 没有找到相关文章

最新更新