在Windows上导入Python中的TensorFlow时出错

use*_*591 3 python pip tensorflow

我正在运行Python 2.7.10并且我成功安装了TensorFlow pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl.

当我运行python解释器并尝试导入tensorflow模块时,我收到以下错误:

>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Or\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\__init__.py", line 4, in <module>
    from tensorflow.python import *
  File "C:\Users\Or\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\python\__init__.py", line 22, in <module>
    from tensorflow.python.client.client_lib import *
  File "C:\Users\Or\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\python\client\client_lib.py", line 35, in <module>
    from tensorflow.python.client.session import InteractiveSession
  File "C:\Users\Or\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\python\client\session.py", line 11, in <module>
    from tensorflow.python import pywrap_tensorflow as tf_session
  File "C:\Users\Or\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "C:\Users\Or\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
    import _pywrap_tensorflow
ImportError: No module named _pywrap_tensorflow
Run Code Online (Sandbox Code Playgroud)

Jib*_*hew 6

你可以使用pip来安装tensorflow

pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
Run Code Online (Sandbox Code Playgroud)

如果您尝试在Windows上安装,则必须使用python3.5 x64位,并且需要安装Visual C++ 2015可再发行(x64版本)才能导入tensorflow

  • 安装C++ 2015可再发行组件就可以了.谢谢. (2认同)