如何安装kaggle API下载数据 及报错OSError: Could not find kaggle.json. Make sure it‘s located /解决办法
C:\Users\pc>pip install kaggle
报错OSError: Could not find kaggle.json. Make sure it‘s located /解决办法
kaggle --> My Account --> API --> Create New API Token,下载得到kaggle.json文件,放在C:\Users\pc\.kaggle 或者/home/user/.kaggle隐藏文件夹下
解决后下载成功界面如下
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting kaggle
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/62/ab/bb20f9b9e24f9a625
0f95a432f8d9a7d745f8d24039d7a5a6eaadb7783ba/kaggle-1.5.6.tar.gz (58kB)
|█████████████████ | 30kB 1.9MB/s eta 0:00:0
|██████████████████████▌ | 40kB 1.3MB/s eta
|████████████████████████████ | 51kB 1.1MB/s
|████████████████████████████████| 61kB 787
kB/s
Collecting urllib3<1.25,>=1.21.1
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/01/11/525b02e4acc0c747d
e8b6ccdab376331597c569c42ea66ab0a1dbd36eca2/urllib3-1.24.3-py2.py3-none-any.whl
(118kB)
|████████████████▌ | 61kB 1.9MB/s eta 0:00:0
|███████████████████ | 71kB 2.2MB/s eta 0:00
|██████████████████████ | 81kB 1.7MB/s eta 0
|█████████████████████████ | 92kB 2.0MB/s et
|███████████████████████████▌ | 102kB 2.2MB/
|██████████████████████████████▌ | 112kB 2.2
|████████████████████████████████| 122kB 2.
2MB/s
Requirement already satisfied: six>=1.10 in c:\programdata\anaconda3\lib\site-pa
ckages (from kaggle) (1.13.0)
Requirement already satisfied: certifi in c:\users\pc\appdata\roaming\python\pyt
hon37\site-packages (from kaggle) (2020.6.20)
Requirement already satisfied: python-dateutil in c:\users\pc\appdata\roaming\py
thon\python37\site-packages (from kaggle) (2.8.1)
Requirement already satisfied: requests in c:\users\pc\appdata\roaming\python\py
thon37\site-packages (from kaggle) (2.24.0)
Requirement already satisfied: tqdm in c:\programdata\anaconda3\lib\site-package
s (from kaggle) (4.36.1)
Collecting python-slugify
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/9f/42/e336f96a8b6007428
df772d0d159b8eee9b2f1811593a4931150660402c0/python-slugify-4.0.1.tar.gz
Requirement already satisfied: idna<3,>=2.5 in c:\users\pc\appdata\roaming\pytho
n\python37\site-packages (from requests->kaggle) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\pc\appdata\roaming\
python\python37\site-packages (from requests->kaggle) (3.0.4)
Collecting text-unidecode>=1.3
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a6/a5/c0b6468d3824fe3fd
e30dbb5e1f687b291608f9473681bbf7dabbf5a87d7/text_unidecode-1.3-py2.py3-none-any.
whl (78kB)
|█████████████████ | 40kB 79kB/s eta 0:00:01
|█████████████████████ | 51kB 99kB/s eta 0:0
|█████████████████████████ | 61kB 115kB/s et
|█████████████████████████████▌ | 71kB 135kB
|████████████████████████████████| 81kB 125
kB/s
Building wheels for collected packages: kaggle, python-slugify
Building wheel for kaggle (setup.py) ... done
Created wheel for kaggle: filename=kaggle-1.5.6-cp37-none-any.whl size=72864 s
ha256=8456ce02d02db339fc1b86f8383c4dc942064791fc40cf1a96332ecc107fe8db
Stored in directory: C:\Users\pc\AppData\Local\pip\Cache\wheels\9e\24\2c\3f85e
90237bf54335b87f3b3bc1bd48e51cd3b414d58b0a3ee
Building wheel for python-slugify (setup.py) ... done
Created wheel for python-slugify: filename=python_slugify-4.0.1-py2.py3-none-a
ny.whl size=6774 sha256=bbae40531e7205a6f21b8cffd91b1bcb8ba92c8a517aabc8821a716a
940be463
Stored in directory: C:\Users\pc\AppData\Local\pip\Cache\wheels\33\81\ab\a33e1
3fd3603dcbab647873dd3b85214001b2c1a8780383f1d
Successfully built kaggle python-slugify
Installing collected packages: urllib3, text-unidecode, python-slugify, kaggle
Found existing installation: urllib3 1.25.9
Uninstalling urllib3-1.25.9:
Successfully uninstalled urllib3-1.25.9
Successfully installed kaggle-1.5.6 python-slugify-4.0.1 text-unidecode-1.3 urll
ib3-1.25.7
C:\Users\pc>kaggle competitions download -c quora-question-pairs
Traceback (most recent call last):
File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\Scripts\kaggle.exe\__main__.py", line 4, in
File "c:\programdata\anaconda3\lib\site-packages\kaggle\__init__.py", line 23,
in
api.authenticate()
File "c:\programdata\anaconda3\lib\site-packages\kaggle\api\kaggle_api_extende
d.py", line 149, in authenticate
self.config_file, self.config_dir))
OSError: Could not find kaggle.json. Make sure it's located in C:\Users\pc\.kagg
le. Or use the environment method.
C:\Users\pc>kaggle competitions download -c quora-question-pairs
Downloading quora-question-pairs.zip to C:\Users\pc
1%|▏ | 2.00M/309M [00:00<02:27, 2.19MB/s]
1%|▎ | 3.00M/309M [00:01<02:12, 2.42MB/s]
1%|▍ | 4.00M/309M [00:01<02:07, 2.51MB/s]
2%|▌ | 5.00M/309M [00:01<01:59, 2.67MB/s]
2%|▋ | 6.00M/309M [00:02<01:53, 2.80MB/s]
2%|▊ | 7.00M/309M [00:02<01:52, 2.82MB/s]
3%|▉ | 8.00M/309M [00:02<01:48, 2.91MB/s]
3%|█ | 9.00M/309M [00:03<01:45, 2.99MB/s]
3%|█▏ | 10.0M/309M [00:03<01:43, 3.02MB/s
4%|█▎ | 11.0M/309M [00:04<01:44, 2.99MB/s
4%|█▍ | 12.0M/309M [00:04<01:41, 3.06MB/s
4%|█▌ | 13.0M/309M [00:04<01:53, 2.73MB/s
5%|█▋ | 14.0M/309M [00:05<01:51, 2.78MB/s
5%|█▊ | 15.0M/309M [00:05<01:52, 2.74MB/s
5%|█▉ | 16.0M/309M [00:05<01:47, 2.85MB/s
6%|██ | 17.0M/309M [00:06<01:46, 2.86MB/s
6%|██▏ | 18.0M/309M [00:06<01:46, 2.87MB/
6%|██▎ | 19.0M/309M [00:06<01:46, 2.87MB/
6%|██▍ | 20.0M/309M [00:07<01:46, 2.83MB/
7%|██▌ | 21.0M/309M [00:07<01:42, 2.94MB/
7%|██▋ | 22.0M/309M [00:08<01:42, 2.92MB/
7%|██▊ | 23.0M/309M [00:08<01:40, 2.98MB/
8%|██▉ | 24.0M/309M [00:08<01:38, 3.03MB/
8%|███ | 25.0M/309M [00:09<01:42, 2.90MB/
8%|███▏ | 26.0M/309M [00:09<01:44, 2.84MB
9%|███▎ | 27.0M/309M [00:09<01:45, 2.81MB
9%|███▍ | 28.0M/309M [00:10<02:10, 2.26MB
9%|███▌ | 29.0M/309M [00:10<02:02, 2.40MB
10%|███▋ | 30.0M/309M [00:11<01:55, 2.54MB
10%|███▊ | 31.0M/309M [00:11<01:54, 2.54MB
10%|███▉ | 32.0M/309M [00:12<01:51, 2.60MB
11%|████ | 33.0M/309M [00:12<01:52, 2.58MB
11%|████▏ | 34.0M/309M [00:12<01:48, 2.66M
11%|████▎ | 35.0M/309M [00:13<01:45, 2.72M
12%|████▍ | 36.0M/309M [00:13<01:42, 2.80M
12%|████▌ | 37.0M/309M [00:13<01:40, 2.85M
12%|████▋ | 38.0M/309M [00:14<01:38, 2.88M
13%|████▊ | 39.0M/309M [00:14<01:40, 2.81M
13%|████▉ | 40.0M/309M [00:15<01:38, 2.85M
13%|█████ | 41.0M/309M [00:15<01:42, 2.73M
14%|█████▏ | 42.0M/309M [00:15<01:41, 2.76
14%|█████▎ | 43.0M/309M [00:16<01:41, 2.74
14%|█████▍ | 44.0M/309M [00:16<01:38, 2.83
15%|█████▌ | 45.0M/309M [00:16<01:40, 2.74
15%|█████▋ | 46.0M/309M [00:17<01:37, 2.84
15%|█████▊ | 47.0M/309M [00:17<01:35, 2.87
16%|█████▉ | 48.0M/309M [00:18<01:34, 2.89
16%|██████ | 49.0M/309M [00:18<01:33, 2.93
16%|██████▏ | 50.0M/309M [00:18<01:35, 2.8
17%|██████▎ | 51.0M/309M [00:19<01:34, 2.8
17%|██████▍ | 52.0M/309M [00:19<01:32, 2.9
17%|██████▌ | 53.0M/309M [00:19<01:30, 2.9
17%|██████▋ | 54.0M/309M [00:20<01:28, 3.0
18%|██████▊ | 55.0M/309M [00:20<01:28, 3.0
18%|██████▉ | 56.0M/309M [00:20<01:29, 2.9
18%|███████ | 57.0M/309M [00:21<01:27, 3.0
19%|███████▏ | 58.0M/309M [00:21<01:26, 3.
19%|███████▎ | 59.0M/309M [00:21<01:25, 3.
19%|███████▍ | 60.0M/309M [00:22<01:24, 3.
20%|███████▌ | 61.0M/309M [00:22<01:23, 3.
20%|███████▋ | 62.0M/309M [00:22<01:23, 3.
20%|███████▊ | 63.0M/309M [00:23<01:31, 2.
21%|███████▊ | 64.0M/309M [00:23<01:31, 2.
82MB/s]
最后下载成功的文件名是 在C:/users/pc中
quora-question-pairs.zip
参考
https://blog.csdn.net/qq_40263477/article/details/107801843