やりたいこと
- Ubuntu(WSL2)をインストール
- UbuntuにAnacondaの配布ファイルをダウンロード
- 仮想環境を構築
※「$」はターミナル上であることを示す記号
Ubuntu 導入
- Microsoft Storeで「ubuntu」と検索し,「22.04.1LTS」をインストール
- 起動すると以下のように「username」と「password」を聞かれる
※上記はメモ推奨
※パスワードは入力しても非表示
※再度入力
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: tokumo32
Enter new UNIX password:
Retype new UNIX password:
- 以下になればok
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
お疲れ様でした.
その他
- 再インストールしたUbuntuが起動しない場合はこちらを参照して下さい
Anaconda 導入
- こちらからバージョンを確認して配布ファイルのリンクをコピー
https://repo.anaconda.com/archive/Anaconda3-2025.06-0-Linux-x86_64.sh
- Ubuntu上で以下を実行(wgetコマンドで,上記URLを取得)
$ wget https://repo.anaconda.com/archive/Anaconda3-2025.06-0-Linux-x86_64.sh
※最初にも書いたが「$」は削除してから実行
- 以下になればok
--2025-10-25 22:01:19-- https://repo.anaconda.com/archive/Anaconda3-2025.06-0-Linux-x86_64.sh
Resolving repo.anaconda.com (repo.anaconda.com)... 104.16.191.158, 104.16.32.241, 2606:4700::6810:bf9e, ...
Connecting to repo.anaconda.com (repo.anaconda.com)|104.16.191.158|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1111344533 (1.0G) [application/octet-stream]
Saving to: ‘Anaconda3-2025.06-0-Linux-x86_64.sh’
Anaconda3-2025.06-0-Linux-x86 100%[=================================================>] 1.03G 9.57MB/s in 1m 54s
2025-10-25 22:03:13 (9.30 MB/s) - ‘Anaconda3-2025.06-0-Linux-x86_64.sh’ saved [1111344533/1111344533]
- lsコマンドで確認
$ ls
Anaconda3-2025.06-0-Linux-x86_64.sh
- bashコマンドでインストーラーを実行
$ bash Anaconda3-2025.06-0-Linux-x86_64.sh
Welcome to Anaconda3 2025.06-0
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
※エンターを押す
By continuing installation, you hereby consent to the Anaconda Terms of Serv
ice available at https://anaconda.com/legal.
Do you accept the license terms? [yes|no]
>>> yes
※yesを入力し,エンターを押す
Anaconda3 will now be installed into this location:
/home/tokumo32/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/home/tokumo32/anaconda3] >>>
※エンターを押す
Downloading and Extracting Packages:
Preparing transaction: done
Executing transaction: done
entry_point.py:256: DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.
installation finished.
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,
run the following command when conda is activated:
conda config --set auto_activate_base false
You can undo this by running `conda init --reverse $SHELL`? [yes|no]
[no] >>>yes
※yesを入力し,エンターを押す
no change /home/tokumo32/anaconda3/condabin/conda
no change /home/tokumo32/anaconda3/bin/conda
no change /home/tokumo32/anaconda3/bin/conda-env
no change /home/tokumo32/anaconda3/bin/activate
no change /home/tokumo32/anaconda3/bin/deactivate
no change /home/tokumo32/anaconda3/etc/profile.d/conda.sh
no change /home/tokumo32/anaconda3/etc/fish/conf.d/conda.fish
no change /home/tokumo32/anaconda3/shell/condabin/Conda.psm1
no change /home/tokumo32/anaconda3/shell/condabin/conda-hook.ps1
no change /home/tokumo32/anaconda3/lib/python3.13/site-packages/xontrib/conda.xsh
no change /home/tokumo32/anaconda3/etc/profile.d/conda.csh
modified /home/tokumo32/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
Thank you for installing Anaconda3!
※上記になればok
- ここでUbuntuを開き直す(ここ大事)
(base) tokumo32@○○:~$
※上記のように(base)になればok
仮想環境 構築
- 環境の作成
$ conda create -n <仮想環境名> python=<バージョン>
※仮想環境名は自分で決めてok
※バージョンは最新よりも少し古いくらいがgood
- 以下を実行
$ conda create -n python_3.9 python=3.9
Proceed ([y]/n)? y
※「y」を入力
Downloading and Extracting Packages:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate python_3.9
#
# To deactivate an active environment, use
#
# $ conda deactivate
※上記になればok
- 環境の確認
$ conda env list
# conda environments:
#
base * /home/tokumo32/anaconda3
python_3.9 /home/tokumo32/anaconda3/envs/python_3.9
- 環境に入る
(base) tokumo32@○○:~$ conda activate python_3.9
(python_3.9) tokumo32@○○:~$
※これで「base」から「python_3.9」に入れた
- 環境から出る
(python_3.9) tokumo32@○○:~$ conda deactivate
(base) tokumo32@○○:~$
お疲れ様でした.