Anaconda安装TensorFlow 1.15而不是2.0 [英] Anaconda installs TensorFlow 1.15 instead of 2.0

查看:998
本文介绍了Anaconda安装TensorFlow 1.15而不是2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在Anaconda中安装Tensorflow 2.0.

I've been trying to install Tensorflow 2.0 in Anaconda.

到目前为止,tensorflow可以正常工作(我可以在代码中使用该库),但是当我安装它时,它显示正在安装版本:2.0",然后我得到的版本是1.15.

So far, tensorflow works fine (i can use the library in my code), but when i'm installing it, it says "installing version: 2.0", then i get version 1.15 instead.

整个软件包的结果都是可更新的(因为2.0版确实存在并且应该可用),但是即使我尝试对其进行更新,我仍会得到1.15,该值又回到可更新的状态,然后又回到循环中.

The whole package results updatable (since versione 2.0 does exist and should be available), but even if i try to update it, i keep getting 1.15, which gets back to updatable, and i get back into the loop.

我在Anaconda Navigator界面和使用conda update tensorflow的提示下都尝试了,但没有成功.

I tried both from the Anaconda Navigator interface and the prompt using conda update tensorflow, without any success.

这里有链接包: tensorflow 2.0 Anaconda

我该如何解决该问题?

How can i solve the problem?

我使用conda install -c anaconda tensorflow成功安装了TensorFlow 2.0.然后我回到Anaconda Navigator,并尝试安装Keras 2.2.4.

I successfully installed TensorFlow 2.0 using conda install -c anaconda tensorflow. Then i got back into Anaconda Navigator and i tried to install Keras 2.2.4.

查看已安装的软件包,似乎安装Keras会用1.15覆盖TensorFlow的2.0版,我错了吗?这是一个错误吗?

Looking at the installed packages, seems that installing Keras overwrites the version 2.0 of TensorFlow with the 1.15, am i wrong? Is this a bug?

以下是图片:

推荐答案

conda install -c anaconda tensorflow-gpu

conda install -c anaconda tensorflow

寻找这些:

提示:在安装之前,请在Anaconda环境中完全切碎带有名称子字符串"keras"和"tensorflow"的任何文件-否则东西可能会损坏.

Tip: completely shred any file w/ name substring "keras" and "tensorflow" in your Anaconda environment before installing - else stuff is likely to break.

  1. 导航到您的site-packages
  2. 搜索**keras**->删除所有结果
  3. 搜索**tensorflow**->删除所有结果
  1. Navigate to your site-packages
  2. Search **keras** --> delete all results
  3. Search **tensorflow** --> delete all results

上面的代码应该在环境的根文件夹(例如envs/tf2_env)中更好地工作-想法是,Anaconda会缓存已安装的所有内容,因此,如果未完全删除它,则可能会遇到获取最新版本软件包的麻烦

Above should work even better from the environment's root folder (e.g. envs/tf2_env) -- the idea is, Anaconda caches whatever it's already installed, so if it isn't completely removed, you may find trouble getting latest vers of packages.

在评论中回答有关Q的问题:

  1. 为什么在我尝试安装Keras 2.2.4时conda会将TF 2还原为TF 1.15.0?

  • TF2是唯一兼容Keras 2.2.5+的版本,因此conda负责兼容性

为什么某些from keras导入不再起作用并且需要from tensorflow.keras?

Why are some from keras imports no longer working and need from tensorflow.keras?

  • from keras is very different from from tensorflow.keras, implementation-wise. from keras is backend-neutral, whereas tf.keras is more tightly integrated w/ TF. There can also be significant performance differences. TF2 and onward, tf.keras is preferable, and development will proceed along it, as noted by F. Chollet
  • Also beware of tf.python.keras

这篇关于Anaconda安装TensorFlow 1.15而不是2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆