Kaggle API 问题 "Could not find kaggle.json. Make sure it's located in......"

Kaggle API issue "Could not find kaggle.json. Make sure it's located in......"

我正在尝试使用 Kaggle API 从 kaggle 网站提取数据。我正在使用 Ubuntu 18.04。当我输入以下命令时:

kaggle competitions download -c home-credit-default-risk

我收到以下错误:

Traceback (most recent call last):
  File "/home/hduser/anaconda3/bin/kaggle", line 5, in <module>
    from kaggle.cli import main
  File "/home/hduser/anaconda3/lib/python3.7/site-packages/kaggle/__init__.py", line 23, in <module>
    api.authenticate()
  File "/home/hduser/anaconda3/lib/python3.7/site-packages/kaggle/api/kaggle_api_extended.py", line 149, in authenticate
    self.config_file, self.config_dir))
OSError: Could not find kaggle.json. Make sure it's located in /home/hduser/.kaggle/kaggle.json. Or use the environment method.

这很奇怪,因为我将 kaggle.json 文件保存在正确的目录中,并且我拥有授予它的所有权限。

ls ~/.kaggle

returns:

kaggle.json

我是不是漏掉了什么?

我已经解决了。出于某种原因,以下命令有效,而不是上面发布的命令。

~/.local/bin/kaggle competitions download -c home-credit-default-risk

我遇到了同样的问题。

使用Google的GCP notebook,经过多次尝试,我设法解决了如下问题:

通过Kaggle平台生成API文件(JSON)。

执行: https://adityashrm21.github.io/Setting-Up-Kaggle/