我一直在學習tensorflow,直到現在一切都很好。我甚至用GPU來做一些tensorflow的計算。AttributeError:'NoneType'對象在張量流中沒有屬性'modules'
Traceback (most recent call last):
File "<ipython-input-6-41389fad42b5>", line 1, in <module>
import tensorflow as tf
File "/home/diego/.local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/diego/.local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
ImportError: cannot import name pywrap_tensorflow
這是很容易解決的,我只是重置控制檯:可是突然運行進口tensorflow時爲TF命令我有以下錯誤。但它非常不好,因爲我在每次運行腳本後都需要重置控制檯。 (即使腳本只是「進口tensorflow爲TF」)
當我運行與F5整個腳本我有一個不同的錯誤,即使是唯一的命令是進口tensorflow爲TF。 我正在使用spyder 2.7 Python 2.7.12在Ubuntu 16.04.3 LTS上運行腳本。
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
builtins.execfile(filename, *where)
File "/home/diego/Desktop/Diego/Trial-Job/Code/pointnet/test2tf.py", line 7, in <module>
import tensorflow as tf
File "/home/diego/.local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/diego/.local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/home/diego/.local/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "/home/diego/.local/lib/python2.7/site-packages/google/protobuf/__init__.py", line 37, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "/home/diego/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 50, in <module>
from pkg_resources.extern import six
File "/home/diego/.local/lib/python2.7/site-packages/pkg_resources/extern/__init__.py", line 44, in load_module
mod = sys.modules[extant]
AttributeError: 'NoneType' object has no attribute 'modules'
謝謝。
問題似乎是spyder,如果我在控制檯上工作,我沒有任何錯誤。 –