Created
February 19, 2018 13:05
-
-
Save Epikem/e8af34c0d840c9269297f57bd03dbf3f to your computer and use it in GitHub Desktop.
Windows python unicode problem (chcp 65001). Windows python throws error when I change codepage to unicode (chcp 65001) and try to use python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment