我的系统是Windows 10 x86_64,anaconda 3。
我最初的目标是为本地语言处理安装多语言。 Polyglot需要PyICU才能正常工作。
但是,安装PyICU的默认方式不起作用:
(C:\ProgramData\Anaconda3) C:\WINDOWS\system32>pip install pyicu
Collecting pyicu
Using cached PyICU-1.9.7.tar.gz
Exception:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 32: invalid continuation byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_install.py", line 439, in run_egg_info
command_desc='python setup.py egg_info')
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 32: invalid continuation byte
(C:\ProgramData\Anaconda3) C:\WINDOWS\system32>
所以,基本上,控制台编码和utf-8都不起作用。
为什么?我的Windows'语言环境是ru_RU,但字符串似乎不是俄语。 (虽然我可能无法解码它。)
怎么办?
(C:\ProgramData\Anaconda3) C:\WINDOWS\system32>conda install icu="57.1"
Fetching package metadata ...........
Solving package specifications: .
# All requested packages already installed.
# packages in environment at C:\ProgramData\Anaconda3:
#
icu 57.1 vc14_0 [vc14]
(C:\ProgramData\Anaconda3) C:\WINDOWS\system32>
答案 0 :(得分:4)
我不确定您的设置可能出现什么问题(无法重现),但似乎在Windows上安装PyICU通常是一件相当不方便的事情,因为它要求您从源代码构建软件包,反过来,它需要拥有所有必要的构建工具,库和包含所有适当的位置和匹配版本。
为什么不考虑从here安装预先构建的软件包?
> pip install PyICU-1.9.7-xx-xx-win_amd64.whl
答案 1 :(得分:0)
您应该尝试从here下载相应的whl文件
然后以管理员身份打开Anaconda Prompt并执行以下操作:
python -m pip install <Path to whl here>\PyICU‑2.3.1‑cp37‑cp37m‑win_amd64.whl