为什么ipython没有找到tensorflow包,如下所示?
(tensorflow) [abigail@localhost anaconda3]$ which ipython
~/anaconda3/envs/tensorflow/bin/ipython
(tensorflow) [abigail@localhost anaconda3]$ ipython
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import tensorflow as tf
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-41389fad42b5> in <module>()
----> 1 import tensorflow as tf
ImportError: No module named 'tensorflow'
但是,如果我显式执行bin / ipython,它可以工作,如下所示:
(tensorflow) [abigail@localhost anaconda3]$ envs/tensorflow/bin/ipython
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:53:06)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import tensorflow as tf
In [2]:
没有问题。是什么原因?