2017-07-14 6 views
0

それを無視する:私はCMDでそれをテストする場合 how to install tensorflow on anaconda python 3.6インストールtensorflow、しかしpycharmは、私は(ジョシュアからの回答)によってtensorflowをインストール

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!' 

だから、これは大丈夫shoulb ....私がしようとした場合t pycharmでこのテストを繰り返します(私がpycharmを再起動した後でも): ModuleNotFoundError: 'tensorflow'という名前のモジュールはありません

なぜでしょうか?

答えて

1

あなたは、デフォルト設定ファイルおよびプロジェクト通訳の下アナコンダいずれかを選択するpycharm

外出先でconda's仮想環境を使用する必要があります。

pipを使用してパッケージをインストールする場合は、pipが正しいpythonインスタンスを指していることを確認してください。

1

新しいプロジェクトを作成するときは、PythonインタプリタとしてAnacondaの環境を選択する必要があります。 enter image description here

+0

ピップで他のパッケージをインストールした場合は問題がありますか? – econ

0

プロジェクトの設定からtensorflowをインストールするだけです。あなたはアナコンダは必要ありません。

enter image description here

-1

これは完璧に動作し、エラーが消えました! Pycharm

関連する問題