无法在使用python 2.7的mac上使用imoprt tensorflow
我使用pip安装了TensorFlow,但当我尝试导入它时,出现错误:无法在使用python 2.7的mac上使用imoprt tensorflow,python,tensorflow,Python,Tensorflow,我使用pip安装了TensorFlow,但当我尝试导入它时,出现错误: ImportError Traceback (most recent call last) <ipython-input-4-41389fad42b5> in <module>() ----> 1 import tensorflow as tf /Library/Python/2.7/site-packages/tensorflow/__init__.py in <module>(
ImportError
Traceback (most recent call last)
<ipython-input-4-41389fad42b5> in <module>()
----> 1 import tensorflow as tf
/Library/Python/2.7/site-packages/tensorflow/__init__.py in <module>()
21 from __future__ import print_function
22
---> 23 from tensorflow.python import *
24
25
/Library/Python/2.7/site-packages/tensorflow/python/__init__.py in <module>()
47 _default_dlopen_flags = sys.getdlopenflags()
48 sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_GLOBAL)
---> 49 from tensorflow.python import pywrap_tensorflow
50 sys.setdlopenflags(_default_dlopen_flags)
51
ImportError: cannot import name pywrap_tensorflow
我正在为AttributeError运行numpy 1.11.3版和python 2.7.9版。错误:类型对象“NewBase”没有注释中提到的属性“is_abstract”
升级六号可以解决这个问题。TensorFlow需要-通过解释器检查六个版本:
$ python
>>>import six
>>>print six.\__version\__
或者,您可以简单地使用pip进行检查:
$ pip show six
如果您有六个低于1.10的版本,请升级:
$ pip install --upgrade six
来源: 您安装了什么版本的TensorFlow?@scai我不确定,因为在检查版本之前,我必须将TensorFlow导入python,而我不能这样做。但我遵循了这里给出的方向:这里有两件事要尝试:1 sudo-pip-uninstall-six和&sudo-pip-install-six-upgrade-target=/usr/lib/python2.7/dist-packages,2 cd到另一个目录,然后重试。@scai我这样做了,现在我得到了:AttributeError:type对象“NewBase”没有属性“is_abstract”,这个问题听起来类似于。请看一下其他人提到的解决方案。我有六个1.10.0