Visual Studio 2015 年的 TensorFlow,使用 Canopy 作为 Python 环境

TensorFlow in Visual Studio 2015, using Canopy as the Python environment

我按照 this page and managed to install TensorFlow via pip within Visual Studio 2015. My Python environment runs in Enthought Canopy 上的说明进行操作。安装成功。我刷新了数据库,当我写下以下行时,可以通过 IntelliSense 自动完成:

from tensorflow.examples.tutorials.mnist import input_data

但是,当我在 REPL 中 运行 它时,我看到以下错误消息:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
        File "C:\Users\User\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\__init__.py", line 23, in <module>
        from tensorflow.python import *
File "C:\Users\User\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
        from tensorflow import contrib
        File "C:\Users\User\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\contrib\__init__.py", line 23, in <module>
        from tensorflow.contrib import layers
        File "C:\Users\User\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\contrib\layers\__init__.py", line 68, in <module>
        from tensorflow.contrib.layers.python.layers import *
File "C:\Users\User\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\contrib\layers\python\layers\__init__.py", line 22, in <module>
        from tensorflow.contrib.layers.python.layers.initializers import *
File "C:\Users\User\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\contrib\layers\python\layers\initializers.py", line 24, in <module>
        from tensorflow.python.ops import random_ops
        File "C:\Users\User\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\python\ops\random_ops.py", line 23, in <module>
        from tensorflow.python.framework import ops
        File "C:\Users\User\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\python\framework\ops.py", line 39, in <module>
        from tensorflow.python.framework import versions
        File "C:\Users\User\AppData\Local\Enthought\Canopy\User\lib\site-packages\tensorflow\python\framework\versions.py", line 22, in <module>
        from tensorflow.python import pywrap_tensorflow
        File "C:\Users\User\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\User\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

任何人都可以阐明为什么我收到消息 ImportError: No module named _pywrap_tensorflow,即使 TensorFlow 的安装顺利进行?关于如何解决这个问题有什么建议吗?

当前版本的 TensorFlow 在 Windows 上不支持 运行。特别是,可用的 PIP 包 here 仅适用于 Linux 和 Mac OS X:它们包括一个名为 _pywrap_tensorflow 的本机编译库,该库尚未编译Windows.

作为 , you can run TensorFlow on Windows using a Docker container. There is an open issue on GitHub concerning better Windows support, but this will depend on Bazel adding support for Windows build (currently targeted 今年晚些时候)。