【已解决】【Tensorflow2.12.0版本以后合并CPU和GPU版】Tensorflow-gpu==2.12.0 安装失败解决办法

发布时间 2023-06-25 16:21:06作者: 我记得

! https://zhuanlan.zhihu.com/p/639416152

解决方式:

直接上解决方式,需要知道原因的看后文。

直接安装 tensroflow,从 2022 年 12 月起 tensorflow-gpu 已经合并到 tensorflow 包中了

pip install tensorflow==2.12.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

这里使用清华源安装

报错原因

错误 1:setup.py 报错

error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.

尝试使用成功帖子中的方法
setup.py运行失败

setuptools.extern.packaging.\_tokenizer.ParserSyntaxError: Expected end or semicolon (after name and no valid version specifier)

不是pip的原因

错误 2:未找到匹配的版本

在这里插入图片描述
明明参照别人成功地案例却不正确,这是因为 tensorflow-gpu 之前存在的版本已经被下架了。

根据https://pypi.org/project/tensorflow-gpu/给出的公告:
在这里插入图片描述
所以之前安装成功的博客都不用看了,这种大一统的方式简化了大家的工作量,也不会由之前那么多报错了。