为 windows 8 安装 pip 时出错(希伯来语)

error while installing pip for windows 8 (hebrew)

嗨,我正在尝试在我的电脑上安装 pip - windows 希伯来语中的 8。

我安装了 python 2.7。我在我的路径中添加了 python。

我在 python 文件及其作品中进行了一些随机打印。所以 python 没问题。

当我尝试安装 get-pip.py 时出现此错误:

C:\Users\yogi>python get-pip.py
Exception:
Traceback (most recent call last):
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\basecommand.py",
line 232, in main
    status = self.run(options, args)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\commands\install.
py", line 339, in run
    requirement_set.prepare_files(finder)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\req\req_set.py",
line 235, in prepare_files
    req_to_install, self.upgrade)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\index.py", line 3
05, in find_requirement
    page = self._get_page(main_index_url, req)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\index.py", line 7
83, in _get_page
    return HTMLPage.get_page(link, req, session=self.session)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\index.py", line 8
72, in get_page
    "Cache-Control": "max-age=600",
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
sessions.py", line 473, in get
    return self.request('GET', url, **kwargs)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\download.py", lin
e 365, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
sessions.py", line 461, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
sessions.py", line 610, in send
    r.content
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
models.py", line 728, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes
()
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
models.py", line 653, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
packages\urllib3\response.py", line 256, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\requests\
packages\urllib3\response.py", line 186, in read
    data = self._fp.read(amt)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\cachecont
rol\filewrapper.py", line 54, in read
    self.__callback(self.__buf.getvalue())
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\cachecont
rol\controller.py", line 213, in cache_response
    self.serializer.dumps(request, response, body=body),
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\download.py", lin
e 268, in set
    return super(SafeFileCache, self).set(*args, **kwargs)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\cachecont
rol\caches\file_cache.py", line 83, in set
    with FileLock(name) as lock:
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\lockfile\
mkdirlockfile.py", line 18, in __init__
    LockBase.__init__(self, path, threaded, timeout)
  File "c:\users\yogi\appdata\local\temp\tmppowtnc\pip.zip\pip\_vendor\lockfile\
__init__.py", line 189, in __init__
    hash(self.path)))
  File "C:\Python27\lib\ntpath.py", line 84, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal
not in range(128)

任何帮助将不胜感激

我想你可能想试试这些,因为你正在用希伯来语安装它。

1.) 打开路径 "C:\Python27\Lib\" 并搜索 python 文件“mimetypes.py”.

2.) 打开并编辑该文件。搜索行“default_encoding = sys.getdefaultencoding()

3.) 并在(第 2 步)中搜索到的行之前添加这些行:

if sys.getdefaultencoding() != 'gbk':
  reload(sys)
  sys.setdefaultencoding('gbk')

UnicodeDecode 错误可能是因为您使用了错误版本的 get-pip.py。 Python3中的所有字符串默认都是unicode,但在Python2中不是这样。

如果您尝试将 Python3 的 get-pip 与 Python2 一起使用,这可能是您 error.Try 检查/获取正确版本的原因! :)