博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
TensorFlow MNIST 问题解决
阅读量:4540 次
发布时间:2019-06-08

本文共 1945 字,大约阅读时间需要 6 分钟。

TensorFlow MNIST 问题解决

一、数据集下载错误

错误:IOError: [Errno socket error] [Errno 101] Network is unreachable

A: 手动下载:

下面的四个包

train-images-idx3-ubyte.gz: training set images (9912422 bytes)

train-labels-idx1-ubyte.gz: training set labels (28881 bytes)
t10k-images-idx3-ubyte.gz: test set images (1648877 bytes)
t10k-labels-idx1-ubyte.gz: test set labels (4542 bytes)

B: 将下载到的包拷贝到如下目录(注意新版本已经不是之前的MNIST_data 目录了)

cp *.gz /tmp/tensorflow/mnist/input_data/

二、不能运行

错误: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX0.9166

A: 零时解决办法

mnist_softmax.py 中加入如下代码:

在 import sys 后加入如下代码

import osos.environ['TF_CPP_MIN_LOG_LEVEL']='2'import tensorflow as tf

如果出现如下警告: 'TF_CPP_MIN_LOG_LEVEL' represents the Tensorflow environment variable responsible for logging.

则 在ubuntu 上执行如下:

export TF_CPP_MIN_LOG_LEVEL=2

B: 彻底解决此问题

(1)卸载已安装的tensorflow

sudo pip uninstall tensorflow

(2) 用下面的命令重新编译 tensorflow

GPU & CPU

bazel build -c opt --copt=-march=native --copt=-mfpmath=both --config=cuda -k //tensorflow/tools/pip_package:build_pip_package

仅CPU

bazel build -c opt --copt=-march=native --copt=-mfpmath=both -k //tensorflow/tools/pip_package:build_pip_package

(3)生成安装包

bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

(4) 安装

sudo -H pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl

参考:

三、 安装TensorFlow时出现警告

安装命令:

sudo pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl

警告:

The directory '/home/dyufei/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

解决办法:

用sudo -H 命令安装:

sudo -H pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl

参考:

转载于:https://www.cnblogs.com/dyufei/p/8041336.html

你可能感兴趣的文章
Ubuntu下安装 Mysql
查看>>
LeetCode--Reverse Integer
查看>>
PHP_APC+Ajax实现的监视进度条的文件上传
查看>>
ZOJ2833*(并查集)
查看>>
外连接简要总结
查看>>
第一次作业-准备篇
查看>>
【C++】继承时构造函数和析构函数
查看>>
opencv源代码之中的一个:cvboost.cpp
查看>>
swift
查看>>
pycharm 快捷键
查看>>
Linux常用命令
查看>>
.net中的设计模式---单例模式
查看>>
安装程序工具 (Installutil.exe)22
查看>>
如何简单解释 MapReduce算法
查看>>
解决java.lang.NoClassDefFoundError: org/apache/log4j/Level
查看>>
端口号
查看>>
mysql for macOS安装
查看>>
语言基础
查看>>
C# : 操作Word文件的API - (将C# source中的xml注释转换成word文档)
查看>>
C#中字符串转换成枚举类型的方法
查看>>