Kaggle のインストール,データの一覧表示(Python, kaggle を使用)
前準備
Python 3.12 のインストール
インストール済みの場合は実行不要。
管理者権限でコマンドプロンプトを起動(手順:Windowsキーまたはスタートメニュー > cmd と入力 > 右クリック > 「管理者として実行」)し、以下を実行する。管理者権限は、wingetの--scope machineオプションでシステム全体にソフトウェアをインストールするために必要である。
REM Python をシステム領域にインストール
winget install --scope machine --id Python.Python.3.12 -e --silent
REM Python のパス設定
set "PYTHON_PATH=C:\Program Files\Python312"
set "PYTHON_SCRIPTS_PATH=C:\Program Files\Python312\Scripts"
echo "%PATH%" | find /i "%PYTHON_PATH%" >nul
if errorlevel 1 setx PATH "%PATH%;%PYTHON_PATH%" /M >nul
echo "%PATH%" | find /i "%PYTHON_SCRIPTS_PATH%" >nul
if errorlevel 1 setx PATH "%PATH%;%PYTHON_SCRIPTS_PATH%" /M >nul
【関連する外部ページ】
Python の公式ページ: https://www.python.org/
AI エディタ Windsurf のインストール
Pythonプログラムの編集・実行には、AI エディタの利用を推奨する。ここでは,Windsurfのインストールを説明する。
管理者権限でコマンドプロンプトを起動(手順:Windowsキーまたはスタートメニュー > cmd と入力 > 右クリック > 「管理者として実行」)し、以下を実行して、Windsurfをシステム全体にインストールする。管理者権限は、wingetの--scope machineオプションでシステム全体にソフトウェアをインストールするために必要となる。
winget install --scope machine Codeium.Windsurf -e --silent
【関連する外部ページ】
Windsurf の公式ページ: https://windsurf.com/
Python 用 kaggle インストール
Windows の場合
Windows を使用する場合は,次のように操作する.
python -m pip install -U urllib3 six certifi python-dateutil requests tqdm python-slugify idna chardet Unidecode
python -m pip install -U kaggle
Ubuntu の場合
Ubuntu を使用する場合は,次のように操作する.
# パッケージリストの情報を更新
sudo apt update
sudo apt -y install python3-urllib3 python3-six python3-certifi python3-dateutil python3-requests python3-tqdm python3-slugify python3-idna python3-chardet python3-unidecode
sudo python3 -m pip install -U kaggle
Kaggle のインストール,データの一覧表示
- Kaggle のサインアップを行い,アカウントを取得する. https://www.kaggle.com
- Account タブで,ユーザプロファイル(user profile)を開き,
「Create API Token」をクリック.
- kaggle.json がダウンロードされる.
Windows の場合は,C:\Users\<ユーザ名>\.kaggle\kaggle.json に置く.
Ubuntu の場合は,~/.kaggle/kaggle.json に置く.
- 「kaggle competitions list」で,competitions の一覧が表示される
- 「kaggle datasets list」で,データセットの一覧が表示される