安装awscli时遇到依赖的PyYAML安装出错

错误信息

C:\Users\hoxil>py -m pip install --upgrade --user awscli
Requirement already up-to-date: awscli in c:\users\hoxil\appdata\roaming\python\python36\site-packages
Requirement already up-to-date: colorama<=0.3.7,>=0.2.5 in c:\users\hoxil\appdata\roaming\python\python36\site-packages (from awscli)
Requirement already up-to-date: s3transfer<0.2.0,>=0.1.9 in c:\users\hoxil\appdata\roaming\python\python36\site-packages (from awscli)
Requirement already up-to-date: docutils>=0.10 in c:\users\hoxil\appdata\roaming\python\python36\site-packages (from awscli)
Requirement already up-to-date: botocore==1.7.5 in c:\users\hoxil\appdata\roaming\python\python36\site-packages (from awscli)
Requirement already up-to-date: rsa<=3.5.0,>=3.1.2 in c:\users\hoxil\appdata\roaming\python\python36\site-packages (from awscli)
Collecting PyYAML<=3.12,>=3.10 (from awscli)
  Using cached PyYAML-3.12.tar.gz
Requirement already up-to-date: jmespath<1.0.0,>=0.7.1 in c:\users\hoxil\appdata\roaming\python\python36\site-packages (from botocore==1.7.5->awscli)
Requirement already up-to-date: python-dateutil<3.0.0,>=2.1 in c:\users\hoxil\appdata\roaming\python\python36\site-packages (from botocore==1.7.5->awscli)
Collecting pyasn1>=0.1.3 (from rsa<=3.5.0,>=3.1.2->awscli)
  Downloading pyasn1-0.3.4-py2.py3-none-any.whl (63kB)
    100% |████████████████████████████████| 71kB 1.2MB/s
Requirement already up-to-date: six>=1.5 in c:\users\hoxil\appdata\roaming\python\python36\site-packages (from python-dateutil<3.0.0,>=2.1->botocore==1.7.5->awscli)
Installing collected packages: PyYAML, pyasn1
  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 0xce in position 72: invalid continuation 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 0xce in position 72: invalid continuation byte

解决办法

看起来是标准输出流的编码不对的缘故。使用chcp命令,更改代码页为65001(UTF-8)再执行pip安装命令即可。

你可能感兴趣的:(安装awscli时遇到依赖的PyYAML安装出错)