运行pip给出了UnicodeEncodeError

时间:2015-03-28 09:26:29

标签: django python-2.7 pip python-3.4

我刚刚重新安装了python和pip,但是当我运行命令pip时,我应该会看到pip命令的帮助信息。相反,我得到了这个:

Traceback (most recent call last):
 File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
  "__main__", fname, loader, pkg_name)
 File "C:\Python27\lib\runpy.py", line 72, in _run_code
  exec code in run_globals
 File "C:\Python27\Scripts\pip.exe\__main__.py", line 9, in <module>
 File "C:\Python27\lib\site-packages\pip\__init__.py", line 210, in main
  cmd_name, cmd_args = parseopts(args)
 File "C:\Python27\lib\site-packages\pip\__init__.py", line 165, in parseopts
 parser.print_help()
File "C:\Python27\lib\optparse.py", line 1670, in print_help
  file.write(self.format_help().encode(encoding, "replace"))
File "C:\Python27\lib\optparse.py", line 1650, in format_help
  result.append(self.format_option_help(formatter))
File "C:\Python27\lib\optparse.py", line 1633, in format_option_help
  result.append(group.format_help(formatter))
File "C:\Python27\lib\optparse.py", line 1114, in format_help
  result += OptionContainer.format_help(self, formatter)
File "C:\Python27\lib\optparse.py", line 1085, in format_help
  result.append(self.format_option_help(formatter))
File "C:\Python27\lib\optparse.py", line 1074, in format_option_help
  result.append(formatter.format_option(option))
File "C:\Python27\lib\optparse.py", line 316, in format_option
  help_text = self.expand_default(option)
File "C:\Python27\lib\site-packages\pip\baseparser.py", line 110, in expand_de
fault
  return optparse.IndentedHelpFormatter.expand_default(self, option)
File "C:\Python27\lib\optparse.py", line 288, in expand_default
return option.help.replace(self.default_tag, str(default_value))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf8' in position 11:
ordinal not in range(128)

我之前安装了python 3.4,但想要更改为2.7。在3.4点上运行正常,但是在python3.4上有一些关于django的问题

编辑:用户文件夹包含非ascii字符。这适用于python 3.4但不适用于2.7

1 个答案:

答案 0 :(得分:1)

使用符合ascii标准的字符创建了一个新用户。 Pip现在运行正常,没有错误。