Vincent_Bryan
Vincent_Bryan

Reputation: 178

Failed to import tensorflow in python in Linux using pip3

I used pip3 to install tensorflow.. And after installation, I can find it in

/usr/local/lib/python3.6/site-packages

Besides, I use pip3 list and find it on the list:

vincent@ubuntu:/usr/local/lib/python3.6/site-packages/tensorflow$ pip3 list
backports.weakref (1.0rc1)
bleach (1.5.0)
html5lib (0.9999999)
Markdown (2.6.8)
numpy (1.13.1)
pip (9.0.1)
protobuf (3.3.0)
setuptools (28.8.0)
six (1.10.0)
tensorflow (1.2.1)
Werkzeug (0.12.2)
wheel (0.29.0)

But but I failed to import it in python3.6

vincent@ubuntu:/usr/local/lib/python3.6/site-packages/tensorflow$ python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>>

What's wrong with it? I ran it in Linux14.04(x64) in VMware

Upvotes: 0

Views: 157

Answers (1)

Sid
Sid

Reputation: 488

There may be multiple versions of python installed. You can do the following to ensure that tensorflow is installed for the version you are using -

python -mpip install tensorflow

Here I assume that you are using python prompt to run python. If you are using a different prompt just use that in place of python.

Upvotes: 1

Related Questions