Epikem
2/19/2018 - 1:05 PM

Windows python unicode problem (chcp 65001). Windows python throws error when I change codepage to unicode (chcp 65001) and try to use pyth

Windows python unicode problem (chcp 65001).

Windows python throws error when I change codepage to unicode (chcp 65001) and try to use python.

Problem : 
Windows python throws error when I change codepage to unicode (chcp 65001) and try to use python.

PS C:\Program Files\PowerShell\6.0.0-rc> pip list
Traceback (most recent call last):
  File "d:\python2.7.13\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "d:\python2.7.13\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "D:\Python2.7.13\Scripts\pip.exe\__main__.py", line 5, in <module>
  File "d:\python2.7.13\lib\site-packages\pip\__init__.py", line 28, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "d:\python2.7.13\lib\site-packages\pip\vcs\mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "d:\python2.7.13\lib\site-packages\pip\download.py", line 37, in <module>
    from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner
  File "d:\python2.7.13\lib\site-packages\pip\utils\ui.py", line 57, in <module>
    _BaseBar = _select_progress_class(IncrementalBar, Bar)
  File "d:\python2.7.13\lib\site-packages\pip\utils\ui.py", line 50, in _select_progress_class
    six.text_type().join(characters).encode(encoding)
LookupError: unknown encoding: cp65001
PS C:\Program Files\PowerShell\6.0.0-rc>

Solve:
Add "PYTHONIOENCODING":"utf-8" to vscode or same thing to env PATH.