我的系统是Windows 10 x64
现在我想安装pyicu,但遇到了这样的问题

Collecting pyicu

使用缓存的pyicu-1.9.7.tar.gz
完成命令python setup.py egg_info的输出:
回溯(最近一次呼叫的最后一次):
文件“c:\users\anhvu\appdata\local\temp\pip-build-v5fb9ri4\pyicu\setup.py”,第12行,in
icu_version=os.environ['icu_version']
文件“c:\users\anhvu\appdata\local\programs\python\python35\lib\os.py”,第725行,在getitem中
从“无”提升键错误(键)
keyror:“ICU版本”
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.

我如何解决这个问题?请帮帮我。

最佳答案

您可以从Unofficial Windows Binaries for Python Extension Packages下载相应的whl文件。
例如,用于64位Windows和python3.7版本的最新版本(截至2019年1月13日)是pyicu‑2.2‑cp37‑cp37m‑win amd64.whl。
然后以管理员身份打开Windows PowerShell控制台,cd到放置whl文件的目录,并执行以下命令:

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

或者(如果您已经安装了以前的pyicu版本)
python -m pip install -U .\PyICU‑2.2‑cp37‑cp37m‑win_amd64.whl

关于python - 在python 3.x中安装Pyicu,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46871401/

10-11 22:03