When I installed PyYAML using pip on Windows, I got a UnicodeDecodeError and could not install it, so this is the solution.
Windows 7 Professional SP1 64bit Python 3.6.1 (64bit) pip 9.0.1
When I try to install PyYAML, I get a UnicodeDecodeError ...
python
>pip install PyYAML
Collecting PyYAML
Using cached PyYAML-3.12.tar.gz
Installing collected packages: PyYAML
Running setup.py install for PyYAML ... error
Exception:
Traceback (most recent call last):
File "c:\python36\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 80: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\python36\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\python36\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\python36\lib\site-packages\pip\req\req_install.py", line 878, in install
spinner=spinner,
File "c:\python36\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "c:\python36\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 80: invalid start byte
The problem was solved by changing the character code of the command prompt to "UTF-8".
python
>chcp
Current code page: 932
If "932" is displayed by the chcp command, the character code is "Shift JIS".
You can change the character code to "UTF-8" by specifying "65001" with the chcp command.
python
>chcp 65001
Active code page: 65001
PyYAML was successfully installed.
python
>pip install PyYAML
Collecting PyYAML
Using cached PyYAML-3.12.tar.gz
Installing collected packages: PyYAML
Running setup.py install for PyYAML ... done
Successfully installed PyYAML-3.12
I also got a UnicodeDecodeError when installing the mstranslator package. http://qiita.com/akabei/items/2356bb1ac282f6dd2a45
This was not solved by the method of this article, so I solved it by referring to the following article.
The point of introducing Python external modules on Windows http://qiita.com/yukinoi/items/1fe023408d3e684da983
When developing Python on Windows, there are some character code problems ...