【发布时间】:2016-02-25 09:43:36
【问题描述】:
我刚刚在我的 Mac 上浏览了 cifar10 tensorflow tutorial。这个教程激发了我对 NN 的热情,所以我设置了一个 Ubuntu Server 以便进行大规模训练。
但是我无法在我的服务器上运行 cifar10_train.py。我总是遇到这个错误:
tensorflow源码路径:
~/python/tensorflow/tensorflow/tensorflow/
tensorflow virtualenv 安装路径:
~/tensorflow/
命令:
source ~/tensorflow/bin/activate #activate virtualenv
python/tensorflow/tensorflow/tensorflow/models/image/cifar10/cifar10_train.py #the raw source code of tensorflow is in ~/python/tensorflow/tensorflow/tensorflow
错误:
Traceback (most recent call last):
File "python/tensorflow/tensorflow/tensorflow/models/image/cifar10/cifar10_train.py", line 28, in <module>
import tensorflow.python.platform
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in <module>
from tensorflow.python import *
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 22, in <module>
from tensorflow.python.client.client_lib import *
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/client_lib.py", line 35, in <module>
from tensorflow.python.client.session import InteractiveSession
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 11, in <module>
from tensorflow.python import pywrap_tensorflow as tf_session
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
我像在我的 mac 上一样在 virtualenv 中安装了 tensorflow,并在执行脚本之前正确激活了它。 正如其他线程中的许多人所建议的那样,我已经升级了六个,但是我仍然遇到同样的错误。
更新 1 在通过 github/tensorflow 上的问题线程后,我注意到这是一个涉及 cuda 的错误。我将这些添加到我的路径环境中:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export CUDA_HOME=/usr/local/cuda
我仍然遇到错误,但它已缩短为以下内容:
Traceback (most recent call last):
File "cifar10_train.py", line 28, in <module>
import tensorflow.python.platform
ImportError: No module named tensorflow.python.platform
更新 2 正如有人建议的那样,我通过 pip 安装 protobuf。由于某些奇怪的原因,错误再次发生了变化:
Traceback (most recent call last):
File "cifar10_train.py", line 28, in <module>
import tensorflow.python.platform
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in <module>
from tensorflow.python import *
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 13, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/home/it13095/tensorflow/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"d\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tb\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
【问题讨论】:
标签: python ubuntu cuda tensorflow