gpt4 book ai didi

python - 升级 pip : UnicodeDecodeError: 'utf-8' codec can't decode byte 时出错

转载 作者:太空狗 更新时间:2023-10-29 18:28:43 26 4
gpt4 key购买 nike

我刚刚在 Windows 10 上安装了 python,我正在尝试升级 pip。

我的 windows 用户名有希伯来语字符...

当我尝试运行时:

python -m pip install --upgrade pip

我收到这个错误:

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\עדי\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\basecommand.py", line 211, in main
status = self.run(options, args)
File "C:\Users\עדי\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\commands\install.py", line 311, in run
root=options.root_path,
File "C:\Users\עדי\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\req\req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "C:\Users\עדי\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\req\req_install.py", line 673, in uninstall
for path in pip.wheel.uninstallation_paths(dist):
File "C:\Users\עדי\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\wheel.py", line 512, in unique
for item in fn(*args, **kw):
File "C:\Users\עדי\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\wheel.py", line 531, in uninstallation_paths
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
File "C:\Users\עדי\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1619, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "C:\Users\עדי\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\_vendor\pkg_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.

我猜这与我的希伯来语 Windows 用户名有关,对吗?

我可以在不打开新 windows 用户的情况下升级 pip 吗?

最佳答案

它看起来像是 pip 中的一个错误,它假定其元数据存储为 UTF-8。相反,您的用户名似乎被编码为“windows-1255”。

您可以尝试以下方法:

  1. 备份 C:\Users\עדי\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py
  2. 转到行:1616
  3. utf-8 更改为 mbcs
  4. 重新运行升级

关于python - 升级 pip : UnicodeDecodeError: 'utf-8' codec can't decode byte 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35510743/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com