0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ubuntu+Python環境構築

Posted at

はじめに

  • WSL(Windows Subsystem for Linux) + VSCodeLinuxと同じ環境で快適な開発環境を構築する
  • 1学期の復習も兼ねる

1. WSLをインストール

wsl --install

再起動が必要な場合あり

2. ディストリビューションの確認

wsl -l -v

==> UbuntuがWSL2で入っていることを確認

3. 作業ユーザーでログイン

wsl -d Ubuntu-22.04 -u <ユーザ名>

4. 作業スペースに移動

cd /home/<ユーザ名>

5. プロジェクトフォルダを作成

mkdir <プロジェクト名>
cd <プロジェクト名>

6. venv用パッケージをインストール

sudo apt update
sudo apt install python3-venv

初回のみ

7. Python仮想環境を作成,有効化

python3 -m venv <環境名>
source <環境名>/bin/activate

プロンプトが次のようになればOK

(<環境名>) <ユーザ名>@<PC名>:<プロジェクト名>

VSCodeで開く

code .

VSCodeに「Remote - WSL」拡張機能をインストール

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?