[英]Error when importing TensorFlow in Python on Windows
I am running Python 2.7.10 and I successfully installed TensorFlow, using pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
. 我正在运行Python 2.7.10并使用pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
成功安装了TensorFlow。
When I run the python
interpreter and attempt to import the tensorflow
module, I get the following error: 当我运行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
you can use pip to install tensorflow 你可以使用pip来安装tensorflow
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
If you are trying to install on windows , you will have to have python3.5 x64 bit and along with that you need to install Visual C++ 2015 redistributable (x64 version) to be able to import tensorflow 如果您尝试在Windows上安装,则必须使用python3.5 x64位,并且需要安装Visual C ++ 2015可再发行(x64版本)才能导入tensorflow
Judging by the paths in the output, it looks like you are trying to run TensorFlow on Windows. 从输出中的路径判断,看起来您正试图在Windows上运行TensorFlow。 The package that you have installed is a Mac OS X binary distribution of TensorFlow. 您安装的软件包是TensorFlow的Mac OS X二进制分发版。
Unfortunately, Windows is not currently supported by TensorFlow , and it is unlikely to be supported before its build system (Bazel) adds Windows support. 遗憾的是, TensorFlow目前不支持 Windows,并且在其构建系统(Bazel)添加Windows支持之前不太可能支持Windows。 There is some discussion of progress towards a Windows version on this GitHub issue , and an unsupported contribution that builds TensorFlow using CMake on Windows . 在这个GitHub问题上讨论了Windows版本的进展,以及在Windows上使用CMake构建TensorFlow的不受支持的贡献 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.