简体   繁体   English

TensorFlow安装导致ImportError:没有名为tensorflow的模块

[英]TensorFlow installation results in ImportError: No module named tensorflow

I'm trying to get TensorFlow to work on my Mac (OSX El Capitan 10.11.2). 我正在尝试让TensorFlow在我的Mac(OSX El Capitan 10.11.2)上运行。 I tried the pip install from the setup guide and also followed the instructions in the accepted answer here . 我尝试了pip install 指南中pip install ,并且还按照此处接受的答案中的说明进行操作。

In both cases I am able to successfully activate the virtualenv and my prompt changes to tensorflow. 在这两种情况下,我都能成功激活virtualenv并迅速更改为tensorflow. Python works fine, I'm able to do simple computations on the command line . Python工作正常,我能够在command line上执行简单的计算。 But when I try to import tensorflow: 但是当我尝试导入tensorflow时:

import tensorflow as tf

I repeatedly get this error: 我反复收到此错误:

ImportError: No module named tensorflow

Any help would be appreciated. 任何帮助,将不胜感激。

I had the issue reported in the original question. 我有原始问题中报告的问题。 Python worked fine, I followed the installation steps on the Tensforflow website, and got "No module named tensorflow." Python运行良好,我按照Tensforflow网站上的安装步骤进行操作,并得到“没有名为tensorflow的模块”。

Re-installing python via brew, and re-installing pip as a result, fixed it. 通过brew重新安装python,并因此重新安装pip,将其修复。 I didn't need to uninstall anything, just the line below along with the normal pip install from the tensorflow installation document afterwards: 我不需要卸载任何东西,只需从tensorflow安装文档中卸载以下行以及正常的pip安装即可:

brew install python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM