【问题标题】:How to download those files from github?如何从 github 下载这些文件?
【发布时间】:2020-09-30 02:24:59
【问题描述】:

我使用 windows 和 Python 的 Anaconda 发行版和 git bash 来读取 .sh 文件。我无法在此处安装文件: https://github.com/TalwalkarLab/leaf/tree/master/data/femnist

我使用 git bash 和命令在 python 中克隆了叶子文件夹 git克隆https://github.com/TalwalkarLab/leaf.git

正如 /femnist 中的 readme.md 文件所建议的那样,我尝试运行 preprocess.sh(首先没有特定参数)

我一开始遇到了麻烦,因为shell不知道“python3”是什么,所以我复制了“python.exe”并将其重命名为“python3.exe”。

当我使用 cd {path where we can find preprocess.sh} 进入 git bash 时,我尝试运行 preprocess.sh 并获得:

IS234906+admin-local@IS234906 MINGW64 ~/Desktop/CEA/femnist/leaf/data/femnist (master)
$ ./preprocess.sh
------------------------------
extracting file directories of images
Traceback (most recent call last):
  File "get_file_dirs.py", line 27, in <module>
    classes = os.listdir(class_dir)
FileNotFoundError: [WinError 3] The specified path cannot be found: 'C:\\Users\\admin-local\\Desktop\\CEA\\femnist\\leaf\\data\\femnist\\data\\raw_data\\by_class'
finished extracting file directories of images
------------------------------
calculating image hashes
Traceback (most recent call last):
  File "get_hashes.py", line 15, in <module>
    class_file_dirs = util.load_obj(cfd)
  File "C:\Users\admin-local\Desktop\CEA\femnist\leaf\data\utils\util.py", line 10, in load_obj
    with open(name + '.pkl', 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\admin-local\\Desktop\\CEA\\femnist\\leaf\\data\\femnist\\data\\intermediate\\class_file_dirs.pkl'
finished calculating image hashes
------------------------------
assigning class labels to write images
Traceback (most recent call last):
  File "match_hashes.py", line 14, in <module>
    class_file_hashes = util.load_obj(cfhd) # each elem is (class, file dir, hash)
  File "C:\Users\admin-local\Desktop\CEA\femnist\leaf\data\utils\util.py", line 10, in load_obj
    with open(name + '.pkl', 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\admin-local\\Desktop\\CEA\\femnist\\leaf\\data\\femnist\\data\\intermediate\\class_file_hashes.pkl'
finished assigning class labels to write images
------------------------------
grouping images by writer
Traceback (most recent call last):
  File "group_by_writer.py", line 13, in <module>
    write_class = util.load_obj(wwcd)
  File "C:\Users\admin-local\Desktop\CEA\femnist\leaf\data\utils\util.py", line 10, in load_obj
    with open(name + '.pkl', 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\admin-local\\Desktop\\CEA\\femnist\\leaf\\data\\femnist\\data\\intermediate\\write_with_class.pkl'
finished grouping images by writer
------------------------------
converting data to .json format
Traceback (most recent call last):
  File "data_to_json.py", line 43, in <module>
    writers = util.load_obj(by_writer_dir)
  File "C:\Users\admin-local\Desktop\CEA\femnist\leaf\data\utils\util.py", line 10, in load_obj
    with open(name + '.pkl', 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\admin-local\\Desktop\\CEA\\femnist\\leaf\\data\\femnist\\data\\intermediate\\images_by_writer.pkl'
finished converting data to .json format
------------------------------
calculating JSON file checksums
checksums written to meta/dir-checksum.md5

如果有人知道我应该怎么做,那对我有很大帮助。

在此先感谢大家,祝您有美好的一天!

【问题讨论】:

    标签: python bash git


    【解决方案1】:

    我注意到的第一件事是你说你的 shell 不知道 python3 是什么。这意味着您需要在计算机上实际安装 python3。重命名 python.exe 不是有效的解决方法。在您的终端中,您需要运行python3 --version。如果这没有向您返回 python3 版本号,那么您知道您没有安装 python3。 Python 3.7 可以从 windows 商店或https://www.python.org/downloads/windows/ 安装

    之后,使用 git clone https://github.com/TalwalkarLab/leaf.git 重新克隆整个 repo,您​​需要在 repo 的根目录中使用终端使用 pip3 install -r requirements.txt 命令安装自述文件中提到的软件包。

    完成此高级安装后,现在您使用cd data/femnist 进入数据集的目录。最后,运行命令bash ./preprocess.sh

    我遵循了这些确切的步骤(但是,我使用的是 Mac OSX),并且能够以这种方式下载所有数据。

    请告诉我尝试我的解决方案的结果,如果可以的话,我很乐意提供更多见解!

    【讨论】:

    • 我已经做到了,它奏效了。我还必须下载默认情况下未在 Windows 上安装的 wget,但似乎在 UNIX 发行版上。谢谢!
    猜你喜欢
    • 2016-01-09
    • 2013-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-12
    • 2018-01-01
    • 2017-05-09
    • 1970-01-01
    相关资源
    最近更新 更多