在使用tensorflow 1.7版本运行import tensorflow后,我收到非法指令(核心转储)。
之后我安装了 tf 1.5.0-gpu (pip3 install --upgrade tensorflow-gpu==1.5.0)
然后尝试导入tensorflow,我没有收到错误
然而tf.set_random_seed(random_state)
- 返回AttributeError: module 'tensorflow' has no attribute 'set_random_seed'
然后在 jupyter 笔记本中输入 shit-tab
获取库帮助:
Type: module
String form: <module 'tensorflow' (namespace)>
Docstring: <no docstring>
好像不对。然而:
~ $ pip show tensorflow-gpu
Name: tensorflow-gpu
Version: 1.5.0
Summary: TensorFlow helps the tensors flow
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /home/analyst/anaconda3/lib/python3.6/site-packages
Requires: absl-py, wheel, six, tensorflow-tensorboard, numpy, protobuf
Required-by:
$ pip show tensorflow #Returns nothing
可能出了什么问题?
UPD:我有这样的文件,可以通过搜索找到。我害怕 1.1.0 tf。可以吗?
>qqusr@qqusr-PC ~ $ locate -i tensorflow.py
/home/qqusr/anaconda3/pkgs/tensorflow-1.1.0-np112py36_0/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py
/home/qqusr/tensorflow/tensorflow/tools/dist_test/scripts/k8s_tensorflow.py
更新:我有 2 个事件的命名空间:如何解决这个问题:
> tf.__path__
_NamespacePath(['/home/aa/tensorflow', '/home/aa/anaconda3/lib/python3.6/site-packages/tensorflow'])
最佳答案
1) 对 @JaeDukSeo 有效的一种方法是使用预编译版本 https://www.lfd.uci.edu/~gohlke/pythonlibs/#tensorflow
此外,您可以尝试一下预编译的 GPU 版本:https://github.com/mind/wheels .
2)但是,安装预计算版本会导致另一个错误,即英特尔库的问题。试图解决这样的问题我找到了解决方案 conda install -c anaconda tensorflow-gpu
您也可以在此处指定要安装的版本
关于python - 如何修复空的 tensorflow 安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50556599/