TensorFlow与Eclipse [英] TensorFlow with Eclipse
问题描述
我正在尝试使用Eclipse Mars for Mac OS X运行TensorFlow Python示例,但是出现以下错误:
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
第三行出现错误:
from __future__ import absolute_import
from __future__ import print_function
import tensorflow.python.platform
我是Python和TensorFlow的新手.我正在使用PyDev for Eclipse.我读过某个地方可以将代码添加到外部库"文件夹中,但是我不确定TensorFlow库在哪里.
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.
我按照TensorFlow网站上的安装说明安装了TensorFlow.
I installed TensorFlow following the installation directions on the TensorFlow website.
我想念什么?
推荐答案
这听起来像是您的Python环境遇到了问题.解决此问题的最简单方法是执行以下步骤:
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:
-
按照说明这里.这避免了获得root特权的需要,并使得尝试使用不同版本的TensorFlow变得更加容易. (这还避免了与其他库的系统安装版本的冲突.)
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.)
按照本指南.这涉及设置一个新的解释器",其库将是virtualenv中的库集.您可能需要重新创建Eclipse项目才能使用此解释器.
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.
这篇关于TensorFlow与Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!