Python 3.6.4 / win10 使用pip安裝keras時遇到依賴的PyYAML安裝出錯,win10keras

來源:互聯網
上載者:User

Python 3.6.4 / win10 使用pip安裝keras時遇到依賴的PyYAML安裝出錯,win10keras

PS C:\Users\myjac\Desktop\simple-chinese-ocr> pip install kerasCollecting 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/sCollecting 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/sRequirement 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/sInstalling collected packages: scipy, pyyaml, keras  Running setup.py install for pyyaml ... errorException: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 byteDuring 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

 

解決方案

看起來是標準輸出資料流的編碼不對的緣故。使用chcp命令,更改字碼頁為65001(UTF-8)再執行pip安裝命令即可。

 

另外提供一些chcp命令的參考:

chcp 65001  就是換成UTF-8字碼頁chcp 936 可以換回預設的GBKchcp 437 是美國英語  

 

2018.01.05

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.