鍍金池/ 問答/Python  HTML  Office/ win10安裝完tensorflow成功后,再安裝keras失敗

win10安裝完tensorflow成功后,再安裝keras失敗

我先安裝了anaconda2,再在他的envs目錄下安裝anaconda3,想要python2,3共存

(E:\ANACONDA) C:\Users\Administrator>E:\ANACONDA\envs\PY3\Scripts\pip install tensorflow

上面這段安裝tensorflow成功
我之前有在python2的環(huán)境下安裝keras在python2環(huán)境下的Jupyter可以import進(jìn)去

(E:\ANACONDA) C:\Users\Administrator>E:\ANACONDA\envs\PY3\Scripts\pip install keras
Collecting keras

再使用上面這個(gè)命令安裝keras,報(bào)錯(cuò)

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

網(wǎng)上有一個(gè)方法如下,但是好像因?yàn)槲业膒ython2已經(jīng)安裝了keras,它拒絕再安裝了

(E:\ANACONDA) C:\Users\Administrator>E:\ANACONDA\envs\PY3\Scripts\conda install pip
Fetching package metadata .............
Solving package specifications: .

InstallError: Error: one or more of the packages already installed depend on 'conda'
and should only be installed in the root environment: conda conda-env
These packages need to be removed before conda can proceed.
回答
編輯回答
陌如玉

好吧,問題還是要自己先研究一下
第一步,用anaconda prompt在anaconda\envs目錄下創(chuàng)建python35,再在里面安裝tensorflow和keras

第二步,還是anaconda prompt里面activate python35,python -m ipykernel install --user,就是在anaconda2環(huán)境下的jupyter里面創(chuàng)建python3的核

clipboard.png

clipboard.png
我之前有安裝好,在spyder上導(dǎo)入keras提示我CPU運(yùn)算量不足的,不過現(xiàn)在在jupyter里面沒有再提醒了

Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2018年2月25日 08:53