LoginSignup
1
3

Windows 11 の VSCode の Python 開発環境の構築

Last updated at Posted at 2024-01-22

この記事では 18 歳の新入社員向けに VSCode の Python 開発環境を構築する手順を説明します。

前回のおさらい

「Windows 11 への Python のインストール」 では Windows 11 に Python3 をインストールしました。「Windows 11 への VSCode のインストール」 では Windows 11 に VSCode をインストールしました。

引き続き VSCode に Python 拡張機能をインストールし、Python 開発を行う方法を説明します。

Python 開発環境の構築

Visual Studio Code の起動

スタートメニューから「Visual Studio Code」を起動します。

41_vscode.png

拡張機能の追加

左端にある「拡張機能」アイコンをクリックします。

32_installer.png

拡張機能 の検索

拡張機能の検索ボックスに「python」と入力します。

43_extension.png

拡張機能 のインストール

検索結果に Python (Python extension for Visual Studio Code) が表示されたら、「インストール」をクリックします。

34_installer.png

以上で基本的な環境構築は完了です。

Python アプリケーションの作成例

新しいファイルの作成

VSCode のメニューから「ファイル」 > 「新しいファイル」の順にクリックします。

61_python.png

ファイルの種類の選択

ファイルの種類の選択が表示されたら「Python ファイル」をクリックします。

63_python.png

プログラムの入力

エディタが開いたら、以下のソース コードを入力します。

Untitled-1.py
msg = "Hello world!"
print(msg)

プログラムの実行

画面右上にある 再生ボタン ▷ をクリックします。

65_python.png

ファイルの保存

名前を付けて保存の画面が表示されたら、デスクトップフォルダに hello.py として保存します。

69_python.png

プログラムの動作完了

下のターミナルコンソールに、「Hello, World!」 と表示されると動作完了です。

71_python.png

参考文献

-Python
https://marketplace.visualstudio.com/items?itemName=ms-python.python

-Python Debugger
https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy

-Pylance
https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3