今天打算安装python 的keras 包进行学习的,贴一个相关的学习网址谨防忘记!(https://www.leiphone.com/news/201708/fhJ72ZPlmYr12CwV.html)
在cmd 窗口中输入了 pip install keras
之后,安装过程中出现了如下错误:
Collecting keras
Downloading http://mirrors.aliyun.com/pypi/packages/68/89/58ee5f56a9c26957d97217db41780ebedca3154392cb903c3f8a08a52208/Keras-2.1.2-py2.py3-none-any.whl (304kB)
100% |████████████████████████████████| 307kB 4.7MB/s
Collecting scipy>=0.14 (from keras)
Downloading http://mirrors.aliyun.com/pypi/packages/09/e9/89a97bcdbdc7aaafea93b6638f9b167ab599b58b5f9832c5a589e8e5d005/scipy-1.0.0-cp36-none-win32.whl (26.0MB)
100% |████████████████████████████████| 26.0MB 11.4MB/s
Requirement already satisfied: six>=1.9.0 in c:\users\myjac\appdata\local\programs\python\python36-32\lib\site-packages (from keras)
Requirement already satisfied: numpy>=1.9.1 in c:\users\myjac\appdata\local\programs\python\python36-32\lib\site-packages (from keras)
Collecting pyyaml (from keras)
Downloading http://mirrors.aliyun.com/pypi/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz (253kB)
100% |████████████████████████████████| 256kB 12.8MB/s
Installing collected packages: scipy, pyyaml, keras
Running setup.py install for pyyaml ... error
Exception:
Traceback (most recent call last):
File "c:\users\myjac\appdata\local\programs\python\python36-32\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 68: invalid continuation byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\myjac\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\users\myjac\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "c:\users\myjac\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "c:\users\myjac\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_install.py", line 878, in install
spinner=spinner,
File "c:\users\myjac\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "c:\users\myjac\appdata\local\programs\python\python36-32\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 68: invalid continuation byte
百度查找原因,说是 cmd标准输出流的编码不对的缘故,要用chcp
命令更改字符格式
命令介绍:
chcp 65001 #换成utf-8代码页
chcp 936 #换成默认的gbk
chcp 437 #美国英语
之后再执行pip 安装就可以了
本博文方法参考自:
https://www.cnblogs.com/snaildev/p/8204568.html