Cannot install Keras on conda with Python 2.7

2019-08-21 08:10发布

问题:

I have Anaconda 5.0.1 installed on Windows 10 64 bit, with Python 2.7 (yes, I know...please don't ask :) I'm not able to install Keras on my machine:

(C:\ProgramData\Anaconda2) C:\...\Documents>conda install keras
Fetching package metadata .............
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:
  - keras -> python >=3.5,<3.6.0a0
  - keras -> tensorflow -> html5lib ==0.9999999
  - python 2.7*
Use "conda info <package>" to see the dependencies for each package.

Using conda info keras I get

(C:\ProgramData\Anaconda2) C:\...\Documents>conda info keras
Fetching package metadata .............

keras 2.0.8 py36h65e7a35_0
--------------------------
file name   : keras-2.0.8-py36h65e7a35_0.tar.bz2
name        : keras
version     : 2.0.8
build string: py36h65e7a35_0
build number: 0
channel     : defaults
size        : 419 KB
arch        : None
license     : MIT
license_family: MIT
md5         : 3caf1415f85ea20314990f3de7dfc189
noarch      : None
platform    : None
subdir      : win-64
timestamp   : 1508953117568
url         : https://repo.continuum.io/pkgs/main/win-64/keras-2.0.8-py36h65e7a35_0.tar.bz2
dependencies:
    h5py
    numpy >=1.9.1
    python >=3.6,<3.7.0a0
    pyyaml
    scipy >=0.14
    six >=1.9.0
    tensorflow

keras 2.0.8 py35h15001cb_0
--------------------------
file name   : keras-2.0.8-py35h15001cb_0.tar.bz2
name        : keras
version     : 2.0.8
build string: py35h15001cb_0
build number: 0
channel     : defaults
size        : 421 KB
arch        : None
license     : MIT
license_family: MIT
md5         : ca5a05bc857fd4643a68cc82308be03f
noarch      : None
platform    : None
subdir      : win-64
timestamp   : 1508953168861
url         : https://repo.continuum.io/pkgs/main/win-64/keras-2.0.8-py35h15001cb_0.tar.bz2
dependencies:
    h5py
    numpy >=1.9.1
    python >=3.5,<3.6.0a0
    pyyaml
    scipy >=0.14
    six >=1.9.0
    tensorflow

Ok, so it would seem that Keras requires Python 3. However, both the Keras docs and the Keras GitHub repo state that Keras is compatible with: Python 2.7-3.6. I'm a bit surprised: why can't I install it? Is there any possible fix?