1. 아나콘다를 설치한다.
https://www.anaconda.com/products/distribution
Anaconda | Anaconda Distribution
Anaconda's open-source Distribution is the easiest way to perform Python/R data science and machine learning on a single machine.
www.anaconda.com
2. 아나콘다 shell 에서 환경을 생성하고 활성화한다.
(base) PS C:\Users\danci> conda create -n myactivate my
(base) PS C:\Users\danci> activate my
버전을 확인해보자.
(base) PS C:\Users\danci> conda --version
conda 4.12.0
(base) PS C:\Users\danci> python --version
Python 3.9.7
3. Pytorch 설치
파이토치 홈페이지 가서 설치 명령어를 복사해 온 후 설치한다.
현재 Cuda 10.2는 사용불가, 11.3으로 사용하자.
(base) PS C:\Users\danci> conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
4. OpenCV 설치
(base) PS C:\Users\danci> pip install opencv-python
(base) PS C:\Users\danci> pip install opencv-contrib-python
5. 기타 라이브러리 설치
(base) PS C:\Users\danci> pip install numpy scipy matplotlib ipython scikit-learn pandas pillow
(base) PS C:\Users\danci> conda install -c conda-forge opencv matplotlib jupyterlab scikit-image seaborn git
6. Visual Studio Code 설치 및 연동
확장 탭에서 python, code runner 설치
Cotrol + Alt + P 를 쳐서 명령어 창으로 간다.
Python:Select Interpreter 를 친다.
내가 만든 환경에서의 Python을 선택해준다.
7. 실행시 Anaconda Navigator를 이용하여 Launch 한다.
그냥 vsc 실행할 할 경우 VS Code에서 my conda 환경으로 시작되지 않음.
(이전 vsc 버전에는 자동화하는 json 파일을 입력하면 된다는 내용이 있으나 현재 잘 안되는듯 함.)
원하는 파일에서 우측 마우스 키 눌러서 터미널에서 run 을 시키도록 하자.