私的AI研究会 > CondaEnv
「Anaconda」環境下で各プロジェクトを実行するための仮想環境の構築補手順をまとめる
Windows Windows11/10 Linux Ubuntu22.04LTS/20.04LTS
pip install torch torchvision torchaudio ← CPU の場合 (2024.07.01) pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 ← GPU の場合 (2024.07.01)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu ← CPU の場合 (2024.07.01) pip install torch torchvision torchaudio ← GPU の場合 (2024.07.01)
(****) python -V Python 3.11.7
(****) python -c 'import torch;print(torch.__version__)'
(****) python -c 'import torch;print(torch.zeros(1).cuda())'
(base) nvidia-smi Fri Dec 15 07:51:42 2023 +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 546.33 Driver Version: 546.33 CUDA Version: 12.3 | |-----------------------------------------+----------------------+----------------------+ | GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | :
(base) nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Fri_Nov__3_17:51:05_Pacific_Daylight_Time_2023 Cuda compilation tools, release 12.3, V12.3.103 Build cuda_12.3.r12.3/compiler.33492891_0
(base)conda create -n py_learn python=3.11 -y (base)conda info -e
(base) conda activate py_learn
pip install torch torchvision torchaudio ← CPU の場合 (2024.07.01) pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 ← GPU の場合 (2024.07.01)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu ← CPU の場合 (2024.07.01) pip install torch torchvision torchaudio ← GPU の場合 (2024.07.01)
(py_learn) conda install ffmpeg ffmpeg-python -c conda-forge -y (py_learn) conda install opencv pandas tqdm matplotlib PyYAML -y
(py38_learn) cd /anaconda_win/workspace_pylearn/ ← Windows の場合 (py38_learn) cd ~/workspace_pylearn/ ← Linux の場合 (py38_learn) pip install -r requirements.txt
(py_learn) python -V (py_learn) python -c 'import torch;print(torch.__version__)' (py_learn) python -c 'import torch;print(torch.zeros(1).cuda())'
(py_learn) python -c 'import tkinter'
(py_learn) ffmpeg -h
(py_learn) python detect_number.py --log 0 (py_learn) python detect3_number.py --log 0
(base) conda create -n py38_learn python=3.8 -y (base) conda info -e
(base) conda activate py38_learn
pip install torch torchvision torchaudio ← CPU の場合 (2024.07.01) pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 ← GPU の場合 (2024.07.01)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu ← CPU の場合 (2024.07.01) pip install torch torchvision torchaudio ← GPU の場合 (2024.07.01)
(py38_learn) conda install ffmpeg ffmpeg-python pyaudio dlib -c conda-forge -y
(py38_learn) cd /anaconda_win/workspace_2 ← Windows の場合 (py38_learn) cd ~/workspace_2 ← Linux の場合 (py38_learn) pip install -r requirements2.txt
(py38_learn) pip install imageio[ffmpeg]
(py_learn) python -V (py_learn) python -c 'import torch;print(torch.__version__)' (py_learn) python -c 'import torch;print(torch.zeros(1).cuda())'
(py_learn) python -c 'import tkinter'
(py_learn) ffmpeg -h
(py38_learn) python my_videotool.py 0・ウインドウ表示後クローズボタンを押してしばらくすると終了し次のファイルが生成される
Saving mpeg file → 'test_anim.mp4' Saving gif file → 'test_anim.gif'