只能导入tensorflow CPU,但不能将GPU激活到python中
仅在CPU激活的情况下将tensorflow导入python工作正常,但尝试将GPU激活的版本导入python会导致以下错误:只能导入tensorflow CPU,但不能将GPU激活到python中,python,macos,python-2.7,tensorflow,Python,Macos,Python 2.7,Tensorflow,仅在CPU激活的情况下将tensorflow导入python工作正常,但尝试将GPU激活的版本导入python会导致以下错误: import tensorflow as tf Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Python/2.7/site-packages/tensorflow/__init__.py", line
import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/Library/Python/2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 21, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/Library/Python/2.7/site- packages/tensorflow/python/pywrap_tensorflow.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named _pywrap_tensorflow
将tensorflow导入为tf
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/Library/Python/2.7/site packages/tensorflow/_init__.py”,第23行,在
从tensorflow.python导入*
文件“/Library/Python/2.7/site-packages/tensorflow/Python/_-init___;.py”,第49行,在
从tensorflow.python导入pywrap\u tensorflow
文件“/Library/Python/2.7/site packages/tensorflow/Python/pywrap_tensorflow.py”,第21行,在
_pywrap\u tensorflow=swig\u import\u helper()
swig\u import\u helper中的文件“/Library/Python/2.7/site-packages/tensorflow/Python/pywrap\u tensorflow.py”,第20行
返回importlib.import\u模块(“pywrap\u tensorflow”)
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/_init__.py”,第37行,在导入模块中
__导入(名称)
ImportError:没有名为_pywrap_tensorflow的模块
尝试在GitHub问题页面上发布:尝试在GitHub问题页面上发布: