win10 安裝 keras 發生錯誤

環境 :

win10 professional
以 anaconda 建立的 tensorflow 虛擬環境
執行 tensorflow 環境底下
以 pip 安裝完 tensorflow 後順利安裝完成

接著再以 pip 安裝 keras,出現錯誤訊息

 

錯誤訊息:

TypeError: parse() got an unexpected keyword argument ‘transport_encoding


(tensorflow) neo@LAPTOP-508K7PS8 C:\Users\neo\Documents\pythonwork
> pip install keras
Collecting keras
Exception:
Traceback (most recent call last):
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\req\req_set.py", line 554, in _prepare_file
require_hashes
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\req\req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "C:\Users\neo\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py", line 731, in __init__
namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'

解法:

輸入下面這行指令解決
conda install --force html5lib

 


(tensorflow) neo@LAPTOP-508K7PS8 C:\Users\neo\Documents\pythonwork
> conda install --force html5lib
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\neo\Anaconda3\envs\tensorflow:
The following NEW packages will be INSTALLED:
html5lib: 0.999999999-py35h79d4e7f_0
Proceed ([y]/n)? y
(tensorflow) neo@LAPTOP-508K7PS8 C:\Users\neo\Documents\pythonwork
> pip install keras
Collecting keras
Downloading Keras-2.0.8-py2.py3-none-any.whl (276kB)
100% |████████████████████████████████| 276kB 1.5MB/s
Requirement already satisfied: six>=1.9.0 in c:\users\neo\anaconda3\envs\tensorflow\lib\site-packages (from keras)
Requirement already satisfied: scipy>=0.14 in c:\users\neo\anaconda3\envs\tensorflow\lib\site-packages (from keras)
Requirement already satisfied: pyyaml in c:\users\neo\anaconda3\envs\tensorflow\lib\site-packages (from keras)
Requirement already satisfied: numpy>=1.9.1 in c:\users\neo\anaconda3\envs\tensorflow\lib\site-packages (from keras)
Installing collected packages: keras
Successfully installed keras-2.0.8
(tensorflow) neo@LAPTOP-508K7PS8 C:\Users\neo\Documents\pythonwork
>

參考連結:
https://stackoverflow.com/questions/46499808/pip-throws-typeerror-parse-got-an-unexpected-keyword-argument-transport-enco

1 關於 “win10 安裝 keras 發生錯誤” 的評論

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *