简体   繁体   English

在 python 3.x 中安装 Pyicu

[英]Install Pyicu in python 3.x

My system is Windows 10 x64我的系统是 Windows 10 x64

Now I would like to install pyicu but I encounter with a problem like this现在我想安装pyicu但是我遇到了这样的问题

Collecting pyicu

Using cached PyICU-1.9.7.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "C:\\Users\\ANHVU\\AppData\\Local\\Temp\\pip-build-v5fb9ri4\\pyicu\\setup.py", line 12, in ICU_VERSION = os.environ['ICU_VERSION'] File "C:\\Users\\ANHVU\\AppData\\Local\\Programs\\Python\\Python35\\lib\\os.py", line 725, in getitem raise KeyError(key) from None KeyError: 'ICU_VERSION'使用缓存的 PyICU-1.9.7.ta​​r.gz 命令 python setup.py egg_info 的完整输出:Traceback(最近一次调用最后一次):文件“C:\\Users\\ANHVU\\AppData\\Local\\Temp\\pip-build-v5fb9ri4\\ pyicu\\setup.py”,第 12 行,在 ICU_VERSION = os.environ['ICU_VERSION'] 文件“C:\\Users\\ANHVU\\AppData\\Local\\Programs\\Python\\Python35\\lib\\os.py”,第 725 行,在getitem 中从 None KeyError引发KeyError (key): 'ICU_VERSION'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ANHVU\AppData\Local\Temp\pip-build-v5fb9ri4\pyicu\setup.py", line 26, in <module>
    ICU_VERSION = check_output(('icu-config', '--version')).strip()
  File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 383, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "C:\Users\ANHVU\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 955, 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\ANHVU\AppData\Local\Temp\pip-build-v5fb9ri4\pyicu\setup.py", line 33, in <module>
    ''')
RuntimeError:
Please set the ICU_VERSION environment variable to the version of
ICU you have installed.

How can I resolve this?我该如何解决这个问题? Help me pls.请帮助我。

You can download a corresponding whl file from Unofficial Windows Binaries for Python Extension Packages您可以从Unofficial Windows Binaries for Python Extension Packages下载相应的 whl 文件

For example, the latest version (as of Jan 13 2019) for your 64-bit Windows and Python3.7 version is PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl例如,64 位 Windows 和 Python3.7 版本的最新版本(截至 2019 年 1 月 13 日)是 PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl

Then open the Windows Powershell console as Administrator, cd to the directory where you put the whl file and execute the following command:然后以管理员身份打开 Windows Powershell 控制台,cd 到放置 whl 文件的目录并执行以下命令:

python -m pip install .\PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl

or (if you already have a previous PyICU version installed)或者(如果您已经安装了以前的 PyICU 版本)

python -m pip install -U .\PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl

For the record:备案:

My system (Win 10, 64 bit, python 3.8) gave me the exact same error message.我的系统(Win 10、64 位、python 3.8)给了我完全相同的错误消息。

The solution was to install the 32-bit version of the PyICU whl file, not the 64 bit version.解决方案是安装 32 位版本的 PyICU whl 文件,而不是 64 位版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM