我目前收到错误消息TypeError: softmax() got an unexpected keyword argument 'axis'
。
如果您没有最新的keras / tensorflow,似乎此错误很常见。
我用python3 -c 'import tensorflow as tf; print(tf.__version__)'
检查了我有哪个版本的tensorflow,它返回了0.12.0
,实际上看起来已经过时了。
但是,当我尝试使用pip3 install tensorflow --upgrade
升级tensorflow时,我得到
需求已经是最新的:tensorflow in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.12.0)已满足要求,跳过升级: numpy> = 1.11.0英寸 /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages(来自 tensorflow)(1.15.3)已满足要求,跳过升级: protobuf == 3.1.0英寸 /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (来自tensorflow)(3.1.0)已满足要求,正在跳过 升级:六个> = 1.10.0英寸 /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (来自tensorflow)(1.11.0)已满足要求,正在跳过 升级:车轮> = 0.26英寸 /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (来自tensorflow)(0.32.2)需求已满足,正在跳过 升级:中的setuptools /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (来自protobuf == 3.1.0-> tensorflow)(39.0.1)
我试图用pip3 install --ignore-installed --upgrade tensorflow
强制进行更新,但是得到了:
收集tensorflow找不到满足以下条件的版本 需求张量流(来自版本:)无匹配分布 发现张量流
当我尝试使用python3 -m pip install tensorflow --upgrade
进行升级时:
Requirement already up-to-date: tensorflow in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.12.0)
Requirement already satisfied, skipping upgrade: wheel>=0.26 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from tensorflow) (0.32.2)
Requirement already satisfied, skipping upgrade: protobuf==3.1.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from tensorflow) (3.1.0)
Requirement already satisfied, skipping upgrade: numpy>=1.11.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages(from tensorflow) (1.15.3)
Requirement already satisfied, skipping upgrade: six>=1.10.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from tensorflow) (1.11.0)
Requirement already satisfied, skipping upgrade: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from protobuf==3.1.0->tensorflow) (39.0.1)
当我在程序中打印sys.path时,我得到:
['/Users/myname/topdirect', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages']
pip3 show tensorflow
我得到:
Name: tensorflow
Version: 0.12.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Requires: six, protobuf, numpy, wheel
Required-by:
答案 0 :(得分:1)
首先,我建议使用anaconda环境来管理您的tensorflow版本。另一方面,您需要添加操作系统以使问题更清楚。