本人菜鸟一枚,
要在服务器跑代码,想安装个TensorFlow,用pip install 成功了,可是import失败,百度Google不到原因,求助各位大神!
另,我是把package安装到我的目录文件夹下的,因为没有sudo权限。。。
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "tensorflow/core/framework/graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
File "tensorflow/core/framework/node_def_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 "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 "tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
File "tensorflow/core/framework/resource_handle_pb2.py", line 41, in <module>
options=None, file=DESCRIPTOR),
TypeError: __new__() got an unexpected keyword argument 'file'
我以前也遇到过这个问题,你可以从新创建一个环境,安装tensorflow,如果是Anaconda的话就比较好办,如果你安装了anaconda,采用conda创建新环境,在单独安装tensorflow。