我安装了tensorflow by(约书亚的答案):如何在anaconda python 3.6上安装tensorflow如果在cmd中对其进行测试:
D:\>python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC
v.1
900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>> hello = tf.constant('Hello, TensorFlow!')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'tf' is not defined
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2017-07-14 16:21:53.235367: W d:\build\tensorflow\tensorflow-
r1.2\tensorflow\cor
e\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled
to us
e SSE instructions, but these are available on your machine and could speed
up C
PU computations.
2017-07-14 16:21:53.508199: W d:\build\tensorflow\tensorflow-
r1.2\tensorflow\cor
e\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled
to us
e SSE2 instructions, but these are available on your machine and could speed
up
CPU computations.
2017-07-14 16:21:53.511766: W d:\build\tensorflow\tensorflow-
r1.2\tensorflow\cor
e\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled
to us
e SSE3 instructions, but these are available on your machine and could speed
up
CPU computations.
2017-07-14 16:21:53.515734: W d:\build\tensorflow\tensorflow-
r1.2\tensorflow\cor
e\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled
to us
e SSE4.1 instructions, but these are available on your machine and could
speed u
p CPU computations.
2017-07-14 16:21:53.517818: W d:\build\tensorflow\tensorflow-
r1.2\tensorflow\cor
e\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled
to us
e SSE4.2 instructions, but these are available on your machine and could
speed u
p CPU computations.
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
所以这应该没问题....但是如果我尝试在pycharm中重复此测试(即使在重新启动pycharm之后):ModuleNotFoundError:没有名为“ tensorflow”的模块
有什么想法吗?
您应该conda's
在pycharm上使用虚拟环境
转到“文件”,“默认设置”,然后在项目解释器下选择anaconda。
如果pip
用于安装软件包,请确保pip
指向正确的python实例。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句