close

undefined

最近在K TensorFlow + Keras 深度學習人工智慧實務應用的書籍(上圖),沒想到各種工具書介紹的安裝方式都會遇到不同版本的錯誤。

下述是安裝好 Anaconda + tensorflow 後要安裝 Keras 遇到的錯誤:

Exception:
Traceback (most recent call last):
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\basecomma
nd.py", line 215, in main
    status = self.run(options, args)
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\commands\
install.py", line 335, in run
    wb.build(autobuilding=True)
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\wheel.py"
, line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\req\req_s
et.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\req\req_s
et.py", line 554, in _prepare_file
    require_hashes
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\req\req_i
nstall.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py"
, line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "D:\ProgramData\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 "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py"
, line 568, in _get_pages
    page = self._get_page(location)
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py"
, line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py"
, line 811, in get_page
    inst = cls(resp.content, resp.url, resp.headers)
  File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\pip\index.py"
, line 731, in __init__
    namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'

keras_1.jpg

 

上網查了 Stack overflow (stack overflow 真的是攻城師的好朋友...)

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

這個問題的解決方法是重新上網抓 html5lib 來覆蓋虛擬環境中的 html5lib 即可,然後重新安裝 keras 就可以裝了。

網址如下:

https://github.com/html5lib/html5lib-python

keras_2.jpg

整包抓下來解壓縮,然後只複製 html5lib 資料夾,接下來就是貼到下圖的位址中(下述網址是已經建立好的 tensorflow 虛擬空間)

 

keras_3.jpg

 

然後再重新安裝 keras 就不會遇到錯誤了。

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 葛瑞斯肯 的頭像
    葛瑞斯肯

    葛瑞斯肯樂活筆記

    葛瑞斯肯 發表在 痞客邦 留言(0) 人氣()