老师,运行regression.py报错

来源:3-1 TensorFlow结合mnist进行线性模型训练(1)

风硕依源

2018-05-24 20:34

WARNING:tensorflow:From /Users/chenwengang/Test/mnist/regression.py:4: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.

Instructions for updating:

Please use alternatives such as official/mnist/dataset.py from tensorflow/models.


写回答 关注

3回答

  • Mr_Ricky
    2018-05-30 10:48:40

    如果感觉老师讲的还不错,可以到评论区给老师一个好评

  • Mr_Ricky
    2018-05-24 20:51:38

    从你的截图看来,这是警告,并没有报错,请问最后无法运行出来结果是吗?

    Mr_Ric... 回复风硕依源

    看看是不是没有配置注解

    2018-05-24 21:51:22

    共 2 条回复 >

  • 风硕依源
    2018-05-24 20:55:45

    Please use urllib or similar directly.

    Traceback (most recent call last):

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open

        encode_chunked=req.has_header('Transfer-encoding'))

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request

        self._send_request(method, url, body, headers, encode_chunked)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request

        self.endheaders(body, encode_chunked=encode_chunked)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders

        self._send_output(message_body, encode_chunked=encode_chunked)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output

        self.send(msg)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send

        self.connect()

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1392, in connect

        super().connect()

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 936, in connect

        (self.host,self.port), self.timeout, self.source_address)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 724, in create_connection

        raise err

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 713, in create_connection

        sock.connect(sa)

    OSError: [Errno 65] No route to host


    During handling of the above exception, another exception occurred:


    Traceback (most recent call last):

      File "/Users/chenwengang/Test/mnist/regression.py", line 4, in <module>

        data = input_data.read_data_sets('MNIST_data',one_hot=True)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 250, in new_func

        return func(*args, **kwargs)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py", line 260, in read_data_sets

        source_url + TRAIN_IMAGES)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 250, in new_func

        return func(*args, **kwargs)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py", line 252, in maybe_download

        temp_file_name, _ = urlretrieve_with_retry(source_url)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 250, in new_func

        return func(*args, **kwargs)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py", line 205, in wrapped_fn

        return fn(*args, **kwargs)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py", line 233, in urlretrieve_with_retry

        return urllib.request.urlretrieve(url, filename)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 248, in urlretrieve

        with contextlib.closing(urlopen(url, data)) as fp:

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen

        return opener.open(url, data, timeout)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open

        response = self._open(req, data)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open

        '_open', req)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain

        result = func(*args)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open

        context=self._context, check_hostname=self._check_hostname)

      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open

        raise URLError(err)

    urllib.error.URLError: <urlopen error [Errno 65] No route to host>


    慕慕5050...

    SSL: CERTIFICATE_VERIFY_FAILED, 貌似下载数据集用的默认URL被加了SSL权限认证

    2018-05-28 23:32:00

    共 2 条回复 >

TensorFlow与Flask结合打造手写体数字识别

TensorFlow和flask结合识别自己的手写体数字

20432 学习 · 102 问题

查看课程

相似问题