首页 新闻 搜索 专区 学院

python中import TensorFlow 报错

0
悬赏园豆:10 [待解决问题]

本人菜鸟一枚,

要在服务器跑代码,想安装个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'

小白努力码代码的主页 小白努力码代码 | 初学一级 | 园豆:155
提问于:2018-06-02 21:37
< >
分享
所有回答(1)
0

我以前也遇到过这个问题,你可以从新创建一个环境,安装tensorflow,如果是Anaconda的话就比较好办,如果你安装了anaconda,采用conda创建新环境,在单独安装tensorflow。

既生喻何生亮 | 园豆:208 (菜鸟二级) | 2018-06-11 00:33
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册