tensorflow anaconda编译出错

1.ImportError: /home/caohz/anaconda3/bin/../lib/libstdc++.so.6: versionGLIBCXX_3.4.20’ not found (required by /home/caohz/.cache/bazel/_bazel_caohz/bda4311477a35088d3f24fbaaa2ef0c7/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/api/generator/create_python_api.runfiles/org_tensorflow/tensorflow/python/_pywrap_tensorflow_internal.so)`
解决:查看是否有该文件,没有,安装,再查看。

$ strings /home/douxiao/anaconda3/bin/../lib/libstdc++.so.6 | grep GLIBCXX  
$ conda install libgcc
$ strings /home/douxiao/anaconda3/bin/../lib/libstdc++.so.6 | grep GLIBCXX 

2.tensorflow-1.8.0-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.
编译build -c opt –config=cuda //tensorflow/tools/pip_package:build_pip_package要加sudo

3.ImportError: Could not import tensorflow. Do not import tensorflow from its source directory; change directory to outside the TensorFlow source tree, and relaunch your Python interpreter from there.
创建tensorflow-gpu环境

source activate tensorflow-gpu
source deactivate

4.pip install tensorflow时报错
Cannot uninstall 'html5lib'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
去python目录/lib/site-packages下找到html5lib-0.9999-py3.6.egg-info,将其删除。

5.已装numpy,python下import numpy as np报错:ModuleNotFoundError: No module named ‘numpy’
机器上装了不同python版本,tensorflow使用的python没有装numpy, $ conda install numpy就可以了。

6.python下a=tf.constant([1.0,2.0,3.0],shape=[3],name=’a’)报错AttributeError: module ‘tensorflow’ has no attribute ‘constant’
不要将文件命名为tensorflow.py

猜你喜欢

转载自blog.csdn.net/carina_cao/article/details/80526643