1 download kaggle api
1.1 Anaconda has been installed
-
open cmd (Windows) / open terminal (Ubuntu)
-
conda activate Your conda environment name
Here my environment is called Pytorch
conda activate Pytorch
- Then execute pip install kaggle
pip install kaggle
If you don't have Anaconda installed, please go directly to section 1.2
1.2 Anaconda is not installed
Open the cmd/terminal directly and execute pip install kaggle
pip install kaggle
2. Download the josn file on kaggle
- Open https://www.kaggle.com, if you do not have an account, register an account
- Click on your profile picture, then click on Account
- Here in the API, click Create New Token, and then a file will be downloaded called kaggle.json
3 Put kaggle.josn into the .kaggle folder
3.1 Windows system
- Enter the C:\Users\your username folder
to check whether the current folder has a folder named .kaggle, if not, create one
- Copy the downloaded .json file to the .kaggle/ folder
3.2 Ubuntu system
- Execute the following commands one by one
cd ~
mkdir .kaggle
cd ~/.kaggle/
The meaning of the above command is to enter the current user's home directory first, then create a .kaggle folder in this directory, and then enter ~/.kaggle/
- Copy the downloaded .json file to ~/.kaggle/
4. Download the dataset
- Find the data you want to download on kaggle, copy this line of command
4.1 Use cmd/terminal to execute the download command
- Enter the path to be downloaded, and then open cmd/terminal under the path
- Activate the conda environment (ignored if anaconda is not installed)
- Enter the command we copied from kaggl, press Enter to execute
# 替换成你自己需要在下载的数据集的命令
kaggle competitions download -c birdclef-2023
It can be found that the data set has started to download, and the speed is still ok
4.2 Using VSCode+Jupyter method
Execute the following command to start the download, the downloaded data set will have the same path as your code file
! kaggle competitions download -c birdclef-2023