python - tensorflow 在 anaconda 控制台中工作,在笔记本中失败:.ModuleNotFoundError: No module named 'tensorflow'
问题描述
遵循使用 anaconda 安装 tensorflow 的指南似乎可以作为:
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
打印出你好。但笔记本中的相同代码得到:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-25b92e4d5dec> in <module>()
----> 1 import tensorflow as tf
2 hello = tf.constant('Hello, TensorFlow!')
3 sess = tf.Session()
4 print(sess.run(hello))
ModuleNotFoundError: No module named 'tensorflow'
我在 acaconda 提示符中使用 jupyter notebook 启动了笔记本,上面写着:
(tensorflow) D:\ray\dev\ml\mit>
在我的一个用户目录中。
从 Windows 开始菜单启动 jupyter notebook 也失败了。
启动 jupyter notebook 的正确方法是什么?
解决方案
首先,激活您已tensorflow
安装的 anaconda 环境。然后
conda install nb_conda
仍然在那个环境中,运行jupyter notebook
推荐阅读
- facebook-marketing-api - 如何使用 Facebook-business-python-sdk 从 Facebook 的洞察 api 获得超过 25 个结果?
- c# - 如何使用可用的变量形成 JSON 字符串?
- javascript - 在断言中避免“包含”的 Eslint 规则抛出“应该有 1 个错误但有 0”错误
- android - Google AdMob 游戏崩溃统一
- android - Firebase 匿名登录异常
- javascript - 如何在 asp.net mvc 中制作可搜索的 DropDownList
- java - onValueSelected() 没有在 BarChart 中调用,而是 onNothingSelected() 每次单击任何条形图或 BarChart 中的任何位置时都会调用
- .htaccess - 将php产品链接重定向到其他页面
- javascript - 如何检查数据表中是否存在值
- angular - 如何在primeng 6中使用下拉虚拟滚动