尝试在Windows上安装最新版本的lxml会触发奇怪的解码错误。
如何安装?!
这一行:
pip install -r lxml-3.5.0-cp27-none-win32.whl
触发此错误:
Exception:
Traceback (most recent call last):
File "c:\python34\lib\site-packages\pip\basecommand.py", line 211, in main
status = self.run(options, args)
File "c:\python34\lib\site-packages\pip\commands\install.py", line 282, in run
wheel_cache
File "c:\python34\lib\site-packages\pip\basecommand.py", line 291, in populate_requirement_set
wheel_cache=wheel_cache):
File "c:\python34\lib\site-packages\pip\req\req_file.py", line 77, in parse_requirements
filename, comes_from=comes_from, session=session
File "c:\python34\lib\site-packages\pip\download.py", line 413, in get_file_content
content = f.read()
UnicodeDecodeError: 'cp932' codec can't decode byte 0x8b in position 10: illegal multibyte sequence
答案 0 :(得分:0)
看起来你正试图在Python 3.4上安装Python 2.7。此外,-r
用于从requirements.txt文件进行安装。该错误是因为它试图将二进制轮解码为文本文件。
尝试使用http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml中的lxml-3.5.0-cp34-none-win32.whl
。
只需在与下载的滚轮相同的目录中运行pip install lxml-3.5.0-cp34-none-win32.whl
。