在windows中安装polyglot

2024-09-30 03:22:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我想安装polyglot,但在安装过程中,像pyIcu或pycld2这样的要求会返回错误,因为我在下面插入的代码中清楚地显示了这些错误。 我已尝试安装pkg config,但我的问题没有解决

我不知道如何将ICU_VERSION环境变量设置为我安装的ICU版本

pip install polyglot
Requirement already satisfied: polyglot in c:\users\parsiran\anaconda3\lib\site-packages\polyglot-16.7.4-py3.7.egg (16.7.4)
Requirement already satisfied: numpy>=1.6.1 in c:\users\parsiran\anaconda3\lib\site-packages (from polyglot) (1.18.1)
Requirement already satisfied: wheel>=0.23.0 in c:\users\parsiran\anaconda3\lib\site-packages (from polyglot) (0.34.2)
Requirement already satisfied: six>=1.7.3 in c:\users\parsiran\anaconda3\lib\site-packages (from polyglot) (1.14.0)
Requirement already satisfied: morfessor>=2.0.2a1 in c:\users\parsiran\anaconda3\lib\site-packages\morfessor-2.0.6-py3.7.egg (from polyglot) (2.0.6)
Collecting pycld2>=0.3
  Using cached pycld2-0.41.tar.gz (41.4 MB)
Collecting PyICU>=1.8
  Using cached PyICU-2.4.3.tar.gz (219 kB)
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\ParsIran\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ParsIran\\AppData\\Local\\Temp\\pip-install-wp28hyt4\\PyICU\\setup.py'"'"'; __file__='"'"'C:\\Users\\ParsIran\\AppData\\Local\\Temp\\pip-install-wp28hyt4\\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 'C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\pip-egg-info'
         cwd: C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\
    Complete output (53 lines):
    (running 'icu-config --version')
    (running 'pkg-config --modversion icu-i18n')
    Traceback (most recent call last):
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 62, in <module>
        ICU_VERSION = os.environ['ICU_VERSION']
      File "C:\Users\ParsIran\anaconda3\lib\os.py", line 679, in __getitem__
        raise KeyError(key) from None
    KeyError: 'ICU_VERSION'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 65, in <module>
        ICU_VERSION = check_output(('icu-config', '--version')).strip()
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 18, in check_output
        return subprocess_check_output(popenargs)
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 411, in check_output
        **kwargs).stdout
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 488, in run
        with Popen(*popenargs, **kwargs) as process:
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 1207, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 68, in <module>
        ICU_VERSION = check_output(('pkg-config', '--modversion', 'icu-i18n')).strip()
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 18, in check_output
        return subprocess_check_output(popenargs)
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 411, in check_output
        **kwargs).stdout
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 488, in run
        with Popen(*popenargs, **kwargs) as process:
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 1207, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 73, in <module>
        ''')
    RuntimeError:
    Please install pkg-config on your system or set the ICU_VERSION environment
    variable to the version of ICU you have installed.

    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Tags: installpipinpyliblocallineusers
1条回答
网友
1楼 · 发布于 2024-09-30 03:22:11

PyICU是一个使用二进制文件的Python包。当试图安装它时,python下载源代码并尝试编译它:这就是为什么需要pkg-config和其他工具的原因

另一个解决方案是安装包含二进制文件的版本。在这种情况下,您不需要编译工具就能让它工作

您可以下载适合Python安装的here编译版本的PyICU

我建议您阅读这些帖子AB,以获得详细说明

使用这些命令来识别您的版本,包括以下命令(Python版本和32/64位平台)

python  version
python.exe -c "import struct;print(struct.calcsize('P') * 8)"

相关问题 更多 >

    热门问题