使用tensorflow和keras软件包在R中加载mnist和其他数据集时出错

时间:2020-04-02 01:30:44

标签: r tensorflow keras anaconda mnist

最近几天我一直在为此苦苦挣扎。我正在使用Anaconda和python 3.6版。我想在R中使用keras包。我无法加载R-studio教程中针对tensorflow概述的任何数据集(mnist,fashion_mnist等)。下面是我的配置和调用特定数据集时输出的错误的图片。我不知道如何解决这个问题。感谢您的帮助。

> tf_config()
TensorFlow v2.0.0 (C:\Users\rtlum\ANACON~1\envs\R-RETI~1\lib\site- 
packages\tensorflow\__init__.p)
Python v3.6 (C:/Users/rtlum/anaconda3/envs/r-reticulate/python.exe)
> py_config()
python:         C:/Users/rtlum/anaconda3/envs/r-reticulate/python.exe
libpython:      C:/Users/rtlum/anaconda3/envs/r-reticulate/python36.dll
pythonhome:     C:/Users/rtlum/anaconda3/envs/r-reticulate
version:        3.6.10 |Anaconda, Inc.| (default, Mar 23 2020, 17:58:33) [MSC 
v.1916 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/Users/rtlum/anaconda3/envs/r-reticulate/Lib/site- 
packages/numpy
numpy_version:  1.18.2
tensorflow:     C:\Users\rtlum\ANACON~1\envs\R-RETI~1\lib\site- 
packages\tensorflow\__init__.p

python versions found: 
 C:/Users/rtlum/anaconda3/envs/r-reticulate/python.exe
 C:/Users/rtlum/anaconda3/python.exe

错误:

> dataset_mnist()
Error in py_call_impl(callable, dots$args, dots$keywords) : 
  AttributeError: 'NoneType' object has no attribute 'write'

Detailed traceback: 
  File "C:\Users\rtlum\anaconda3\envs\r-reticulate\lib\site- 
packages\tensorflow_core\python\keras\datasets\mnist.py", line 50, in 
load_data
    '731c5ac602752760c8e48fbffcf8c3b850d9dc2a2aedcf2cc48468fc17b673d1')
  File "C:\Users\rtlum\anaconda3\envs\r-reticulate\lib\site- 
packages\tensorflow_core\python\keras\utils\data_utils.py", line 251, in 
get_file
    urlretrieve(origin, fpath, dl_progress)
  File "C:\Users\rtlum\anaconda3\envs\r-reticulate\lib\urllib\request.py", 
line 284, in urlretrieve
    reporthook(blocknum, bs, size)
  File "C:\Users\rtlum\anaconda3\envs\r-reticulate\lib\site- 
packages\tensorflow_core\python\keras\utils\data_utils.py", line 246, in 
dl_progress
    ProgressTracker.progbar.update(count * block_size)
  File "C:\Program Files\R\R- 
3.6.3\library\keras\python\kerastools\progbar.py", line 23, in 
update_with_patch
    update(self, current, values)
  File "C:\Users\rtlum\anaconda3

0 个答案:

没有答案