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

时间:2015-01-05 10:07:37

标签: python python-2.7 pip

您好我正试图在我的电脑上安装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)

任何帮助都会赞赏

2 个答案:

答案 0 :(得分:0)

以为你可能想尝试这些,因为你用希伯来语安装它。

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

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

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

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

答案 1 :(得分:0)

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

如果您尝试在Python2中使用Python3的get-pip,则可能是您的错误的原因。尝试检查/获取正确的版本! :)