Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorFlow with Eclipse

I'm trying to run the TensorFlow Python examples for with Eclipse Mars for Mac OS X, but I'm getting the following error:

Unresolved import: tensorflow.python.platform 

The error is raised on the 3rd line:

from __future__ import absolute_import
from __future__ import print_function

import tensorflow.python.platform

I'm new to Python and TensorFlow. I'm using PyDev for Eclipse. I read somewhere that I can add code to the "External Libraries" folder but I'm not sure where the TensorFlow library is.

I installed TensorFlow following the installation directions on the TensorFlow website.

What am I missing?

like image 794
Eddy Avatar asked Dec 20 '25 08:12

Eddy


2 Answers

It sounds like you are running into a problem with your Python environment. The easiest way to deal with this is to follow these steps:

  1. Install TensorFlow into a virtualenv, by following the instructions here. This avoids the need to acquire root privileges, and makes it easier to experiment with different versions of TensorFlow. (It also avoids conflicts with other system-installed versions of different libraries.)

  2. Set up PyDev to use your new virtualenv, by following step 5 onwards in this guide. This involves setting up a new "interpreter" whose library will be the set of libraries in the virtualenv. You may need to recreate your Eclipse project to use this interpreter.

like image 57
mrry Avatar answered Dec 21 '25 21:12

mrry


  1. install tensorflow.
  2. in eclipse , assume you have pydev installed, go to preferences>pydev>python interpreter.
  3. in the libraries tab add the path to the lib folder of your tensorflow lib folder.

here is screenshot: enter image description here

like image 43
amr koura Avatar answered Dec 21 '25 21:12

amr koura



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!