本文介绍了pip 安装 UnicodeDecodeError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 pip 在我的新笔记本电脑 (Win 7 64) 上安装 beautifulsoup4 时,出现此错误:

When I'm trying to install beautifulsoup4 on my new notebook (Win 7 64) using pip, I get this error:

Cleaning up...
Exception:
Traceback (most recent call last):
  File "C:Python27libsite-packagespipasecommand.py", line 122, in main
    status = self.run(options, args)
  File "C:Python27libsite-packagespipcommandsinstall.py", line 278, in run

    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundl
e=self.bundle)
  File "C:Python27libsite-packagespip
eq.py", line 1234, in prepare_files
    req_to_install.assert_source_matches_version()
  File "C:Python27libsite-packagespip
eq.py", line 464, in assert_source_ma
tches_version
    % (display_path(self.source_dir), version, self))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9e in position 58: ordinal
 not in range(128)

Traceback (most recent call last):
  File "C:Python27lib
unpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:Python27lib
unpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:Python27Scriptspip.exe\__main__.py", line 9, in <module>
  File "C:Python27libsite-packagespip\__init__.py", line 185, in main
    return command.main(cmd_args)
  File "C:Python27libsite-packagespipasecommand.py", line 161, in main
    text = '
'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9e in position 73: ordinal
 not in range(128)

我使用:pip install beautifulsoup4 命令

您知道问题出在哪里吗?

Do you have an idea where could be the problem?

PS:笔记本在拿到之前是用来做演示的,所以安装了多国语言的程序.

PS: The notebook was used for presentations before get it, so there are programs in multiple languages installed.

推荐答案

这是因为您当前的工作目录包含非 ascii 字符.例如:

This is because your current working directory contains non-ascii characters. E.g.:

$ pwd
$ /home/abuser/Загрузки

这个问题在 pip 1.5.6 中仍然存在,这很糟糕.因此,您可以避免修补 pip 而只需更改您的工作目录即可.

This issue is still present in pip 1.5.6 and this is awful. So, you can avoid patching pip and just change your working dir.

这篇关于pip 安装 UnicodeDecodeError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 18:36