Anaconda安装TensorFlow 1.15而不是2.0 [英] Anaconda installs TensorFlow 1.15 instead of 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.
- 导航到您的
site-packages
- 搜索
**keras**
->删除所有结果 - 搜索
**tensorflow**
->删除所有结果
- Navigate to your
site-packages
- Search
**keras**
--> delete all results - 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的问题:
-
为什么在我尝试安装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
在实现方面与from tensorflow.keras
有很大不同.from keras
与后端无关,而tf.keras
与TF紧密集成.还可能有具有显着性能差异.如tf.python.keras
from keras
is very different fromfrom tensorflow.keras
, implementation-wise.from keras
is backend-neutral, whereastf.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屋!