Windows 8.1上的pip安装flake8中的UnicodeDecodeError [英] UnicodeDecodeError in pip install flake8 on Windows 8.1

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

问题描述

我正在尝试为Python安装flake8模块(以便使用SublimeLinter-flake8包来实现Sublime Text 3),但是在安装时收到错误消息(如下).我在这里做什么错了?

I'm trying to install the flake8 module for Python (in order to use the SublimeLinter-flake8 package to Sublime Text 3) but get an error message on install (below). What am I doing wrong here?

C:\Windows\system32>python -m pip install flake8
Collecting flake8
Exception:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip\basecommand.py", line 223, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip\commands\install.py", line 280, in run
    requirement_set.prepare_files(finder)
  File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 317, in prepare_files
    functools.partial(self._prepare_file, finder))
  File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 304, in _walk_req_to_install
    more_reqs = handler(req_to_install)
  File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 439, in _prepare_file
    req_to_install.populate_link(finder, self.upgrade)
  File "C:\Python27\lib\site-packages\pip\req\req_install.py", line 244, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "C:\Python27\lib\site-packages\pip\index.py", line 486, in find_requirement
    all_versions = self._find_all_versions(req.name)
  File "C:\Python27\lib\site-packages\pip\index.py", line 404, in _find_all_versions
    index_locations = self._get_index_urls_locations(project_name)
  File "C:\Python27\lib\site-packages\pip\index.py", line 378, in _get_index_urls_locations
    page = self._get_page(main_index_url)
  File "C:\Python27\lib\site-packages\pip\index.py", line 810, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "C:\Python27\lib\site-packages\pip\index.py", line 920, in get_page
    "Cache-Control": "max-age=600",
  File "C:\Python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 477, in get
    return self.request('GET', url, **kwargs)
  File "C:\Python27\lib\site-packages\pip\download.py", line 373, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "C:\Python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python27\lib\site-packages\pip\_vendor\requests\sessions.py", line 605, in send
    r.content
  File "C:\Python27\lib\site-packages\pip\_vendor\requests\models.py", line 750, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
  File "C:\Python27\lib\site-packages\pip\_vendor\requests\models.py", line 673, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "C:\Python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 307, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "C:\Python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 243, in read
    data = self._fp.read(amt)
  File "C:\Python27\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 54, in read
    self.__callback(self.__buf.getvalue())
  File "C:\Python27\lib\site-packages\pip\_vendor\cachecontrol\controller.py", line 244, in cache_response
    self.serializer.dumps(request, response, body=body),
  File "C:\Python27\lib\site-packages\pip\download.py", line 276, in set
    return super(SafeFileCache, self).set(*args, **kwargs)
  File "C:\Python27\lib\site-packages\pip\_vendor\cachecontrol\caches\file_cache.py", line 99, in set
    with self.lock_class(name) as lock:
  File "C:\Python27\lib\site-packages\pip\_vendor\lockfile\mkdirlockfile.py", line 18, in __init__
    LockBase.__init__(self, path, threaded, timeout)
  File "C:\Python27\lib\site-packages\pip\_vendor\lockfile\__init__.py", line 189, in __init__
    hash(self.path)))
  File "C:\Python27\lib\ntpath.py", line 85, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 9: ordinal not in range(128)

推荐答案

Padraic 的慷慨帮助之后,我们最终发现问题出在我的计算机名称上,它是Fredrik-Bärbar(请注意,在使用python 0基于索引的代码页850中,ä,即0xe4,位于第10位或第9位).

After startlingly generous help from Padraic, we eventually figured out that the problem was my computer name, which was Fredrik-Bärbar (notice the ä, i.e. 0xe4 in code page 850, there in the 10th place, or 9th place using Python's 0-based indexing).

(此错误与安装时的提示错误中的错误有关,另一个问题由Padraic.)

(This error is related to that in Pip Error when installing, another question solved by Padraic.)

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆