導入

バージョン

Python 2とPython 3

Python 3には後方互換性がありませんが、それが問題とならないならばPython 3を用います。

ダウンロード

Python Install Manager

2025/10から提供されており、従来のインストーラー版を置き換えるとされています。 Windows版のPythonのインストール方法が大きく変わる Python Install Managerが登場:Python最新情報キャッチアップ - @IT かわさきしんじ (2025/10/15) Python Release Python install manager 25.0 | Python.org

Welcome to the Python installation manager configuration helper.

********************************************************************************

Windows is not configured to allow paths longer than 260 characters.

Python and some other apps can exceed this limit, but it requires changing a
system-wide setting, which may need an administrator to approve, and will
require a reboot. Some packages may fail to install without long path support
enabled.
Update setting now? [y/N] y
The setting has been successfully updated, and will take effect after the next reboot.

********************************************************************************

The global shortcuts directory is not configured.

Configuring this enables commands like python3.14.exe to run from your
terminal, but is not needed for the python or py commands (for example, py
-V:3.14).

We can add the directory (C:\Users\username\AppData\Local\Python\bin) to PATH now,
but you will need to restart your terminal to use it. The entry will be removed
if you run py uninstall --purge, or else you can remove it manually when
uninstalling Python.
Add commands directory to your PATH now? [y/N] y
PATH has been updated, and will take effect after opening a new terminal.

********************************************************************************

You do not have the latest Python runtime.

Install the current latest version of CPython? If not, you can use 'py install
default' later to install.

Install CPython now? [Y/n] y
Python install manager was successfully updated to 25.2.

********************************************************************************
Installing Python 3.14.2.
Extracting: ...................................................................✅
To see all available commands, run 'py help'
********************************************************************************

********************************************************************************

Configuration checks completed.

To run these checks again, launch Python install manager from your Start menu,
or py install --configure from the terminal.

********************************************************************************

Usage:
    py <regular Python options>
                         Launch the default runtime with specified options. This
                         is the equivalent of the python command.
    py -V:<TAG>          Launch runtime identified by <TAG>, which should
                         include the company name if not PythonCore. Regular
                         Python options may follow this option.
    py -3<VERSION>       Equivalent to -V:PythonCore\3<VERSION>. The version
                         must begin with the digit 3, platform overrides are
                         permitted, and regular Python options may follow. py -3
                         is the equivalent of the python3 command.
    py exec <any of the above>
                         Equivalent to any of the above launch options, and the
                         requested runtime will be installed if needed.
    py help [<CMD>]      Show help for Python installation manager commands
    py install <TAG>     Download new Python runtimes, or pass --update to
                         update existing installs.
    py list [<FILTER>]   Show installed Python runtimes, optionally filtering by
                         <FILTER>.
    py uninstall <TAG>   Remove one or more runtimes from your machine. Pass
                         --purge to clean up all runtimes and cached files.

Find additional information at https://docs.python.org/dev/using/windows.

View online help? [y/N]

インストーラー版

Download Python | Python.org

"Windows embeddable package"は、他のアプリケーションの一部として動作させるための、最小の環境です。The embeddable package - 4. Using Python on Windows — Python 3.x documentation

既定では%LOCALAPPDATA%\Programs\Python\PythonVersionNumberにインストールされます。Why is Python for Windows not installed in %PROGRAMFILES% ("C:\Program Files")? - Super User

インストール時のオプション「Compile .py files to byte code after installation」をチェックすることで、インタプリタがわずかに高速化されます。python - Should I "Compile .py Files to Byte Code after Installation"? - Stack Overflow

ストアアプリ版

ストアアプリでは、64bit版だけの提供となります。Python Software Foundation - Microsoft Apps

The Microsoft Store package - 4. Using Python on Windows — Python 3.x documentation

%USERPROFILE%\AppData\Local\Microsoft\WindowsAppsにインストールされます。

利用方法

REPL (read–eval–print loop)

REPLは、対話型のインタプリタです。16.1. Interactive Mode - 16. Appendix — Python 3.x documentation

コマンドプロンプトを起動し、Pythonのインストール ディレクトリにあるpython.exeを実行します。2. Using the Python Interpreter — Python 3.x documentation

C:\>Python3*>python
Python 3.*.*
Type "help", "copyright", "credits" or "license" for more information.
>>>

終了するにはCtrl + Zを押下するか、exit()と実行します。

起動しようとしたときに応答がない、もしくはMicrosoft Storeアプリが起動するならば、

C:\>where python

としてファイルのパスを確認します。Pythonを実行しようとしたらMicrosoftStoreに飛ばされた件 #Python3 - Qiita

ショートカットキー

キー 機能
Tab 自動補完
↑ or ↓ コマンド履歴を利用
Ctrl + U カーソル以前のテキストを削除
Ctrl + K カーソル以降のテキストを削除
Ctrl + L 画面をクリア
Ctrl + D REPLを終了

IDLE

IDLEは統合開発環境であり、学習用の環境でもあります。IDLE — Python editor and shell — Python 3.x documentation

スタートメニューの[IDLE (Python)]を実行するか、インストールディレクトリにあるLib\idlelib\idle.pywを実行します。