【发布时间】:2018-05-02 09:13:25
【问题描述】:
我根据here 给出的说明在带有 Anaconda 的 Windows 7(32 位)中安装了 tensorflow。但是在尝试导入 tensorflow 时,出现以下错误:
(tensorflow) C:\Users\h473>python
Python 3.5.5 |Anaconda, Inc.| (default, Apr 7 2018, 04:53:16) [MSC v.1900 32 bi
t (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_imp
ort_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [
dirname(__file__)])
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\imp.
py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_imp
ort_helper
import _pywrap_tensorflow_internal
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\pywrap_tensorflow.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_imp
ort_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [
dirname(__file__)])
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\imp.
py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\h473\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site
-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_imp
ort_helper
import _pywrap_tensorflow_internal
ImportError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_probl
ems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
>>>
我也试过这样安装:
pip install tensorflow
但这甚至没有安装 tensorflow;它给出了以下错误:
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
请提出问题所在以及如何解决。
【问题讨论】:
-
可以添加
pip install tensorflow的回溯吗?这显示什么错误? -
@harshil9968 编辑了最后的问题详细信息以包含确切的错误。
-
@harshil9968 它给出了同样的错误,“错误:导入TensorFlow模块失败。”,还指出缺少tensorflow-gpu文件,但我不想要tensorflow-gpu,我想要只有 CPU 的 tensorflow。
-
也升级你的 pip,下载 get-pip.py stackoverflow.com/questions/4750806/…
标签: python windows python-3.x tensorflow