Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
496 views
in Technique[技术] by (71.8m points)

python - Error while upgrading pip: UnicodeDecodeError: 'utf-8' codec can't decode byte

I've just installed python on windows 10, and I'm trying to upgrade pip.

My windows user name has hebrew charecters...

When I try to run:

python -m pip install --upgrade pip

I get this error:

Collecting pip
Using cached pip-8.0.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 7.1.2
Exception:
Traceback (most recent call last):
  File "C:Users???AppDataLocalProgramsPythonPython35-32libsite-packagespipasecommand.py", line 211, in main
    status = self.run(options, args)
  File "C:Users???AppDataLocalProgramsPythonPython35-32libsite-packagespipcommandsinstall.py", line 311, in run
    root=options.root_path,
  File "C:Users???AppDataLocalProgramsPythonPython35-32libsite-packagespip
eq
eq_set.py", line 640, in install
    requirement.uninstall(auto_confirm=True)
  File "C:Users???AppDataLocalProgramsPythonPython35-32libsite-packagespip
eq
eq_install.py", line 673, in uninstall
    for path in pip.wheel.uninstallation_paths(dist):
  File "C:Users???AppDataLocalProgramsPythonPython35-32libsite-packagespipwheel.py", line 512, in unique
    for item in fn(*args, **kw):
  File "C:Users???AppDataLocalProgramsPythonPython35-32libsite-packagespipwheel.py", line 531, in uninstallation_paths
    r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
  File "C:Users???AppDataLocalProgramsPythonPython35-32libsite-packagespip\_vendorpkg_resources\__init__.py", line 1619, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "C:Users???AppDataLocalProgramsPythonPython35-32libsite-packagespip\_vendorpkg_resources\__init__.py", line 1616, in get_metadata
    return self._get(self._fn(self.egg_info, name)).decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position 22365: invalid continuation byte
You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

I'm geussing this has to do with my Hebrew windows user name, Is that correct?

Can I upgrade pip without opening a new windows user?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It looks like a bug in pip where it's assuming its metadata is stored as UTF-8. Instead, your username appears to be encoded as "windows-1255".

You could try the following:

  1. Backup C:Users???AppDataLocalProgramsPythonPython35-32libsite-packagespip\_vendorpkg_resources\__init__.py
  2. Goto line: 1616
  3. Change utf-8 to mbcs.
  4. Re-run upgrade

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...