簡體   English   中英

升級pip時出錯:UnicodeDecodeError:'utf-8'編解碼器無法解碼字節

[英]Error while upgrading pip: UnicodeDecodeError: 'utf-8' codec can't decode byte

我剛剛在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.

我認為這與我的希伯來語用戶名有關,這是正確的嗎?

我可以在不打開新用戶的情況下升級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. 重新運行升級

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM