머신러닝

본문 바로가기

사이트 내 전체검색


2. 파이토치 개발환경 구축(Anaconda3)

페이지 정보

작성자 관리자 댓글 0건 조회 1,975회 작성일 20-02-25 12:37

본문

1. 아나콘다3 설치하기


2. 파이썬 환경설정


아나콘다 설치가 끝나면, Anaconda Prompt에서 파이썬 환경 설치, 각종 라이브러리 설치, 스크립트 실행 등의 작업을 한다.


2.1 새로운 파이썬 환경 생성


(base) C:\Users\jklee>conda create -n pytlesson
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.7.12
  latest version: 4.8.2

Please update conda by running

    $ conda update -n base -c defaults conda


## Package Plan ##

  environment location: C:\Anaconda3\envs\pytlesson


Proceed ([y]/n)? y

 

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate pytlesson
#
# To deactivate an active environment, use
#
#     $ conda deactivate


(base) C:\Users\jklee>
 

여기서 파이썬 환경 이름을 pytlesson이라고 했지만 다른 이름을 써도 무방하다.


파이썬 환경을 생성하고 나면 아래 명령으로 새론 만든 환경을 활성화 한다.


(base) C:\Users\jklee>activate pytlesson

(pytlesson) C:\Users\jklee>



2.2 파이토치 설치


(pytlesson) C:\Users\jklee>conda install -c peterjc123 pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.7.12
  latest version: 4.8.2

Please update conda by running

    $ conda update -n base -c defaults conda


## Package Plan ##

  environment location: C:\Anaconda3\envs\pytlesson

  added / updated specs:
    - pytorch


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    certifi-2019.11.28         |           py36_0         154 KB
    cffi-1.14.0                |   py36h7a1dbc1_0         222 KB
    intel-openmp-2020.0        |              166         1.5 MB
    mkl-2020.0                 |              166        98.9 MB
    mkl-service-2.3.0          |   py36hb782905_0         210 KB
    mkl_fft-1.0.15             |   py36h14836fe_0         118 KB
    mkl_random-1.1.0           |   py36h675688f_0         233 KB
    numpy-1.18.1               |   py36h93ca92e_0           6 KB
    numpy-base-1.18.1          |   py36hc3f5095_1         3.8 MB
    pip-20.0.2                 |           py36_1         1.7 MB
    pycparser-2.19             |           py36_0         171 KB
    python-3.6.10              |       h9f7ef89_0        15.9 MB
    pytorch-0.3.1              |py36_cuda80_cudnn6he774522_2       349.3 MB  peterjc123
    setuptools-45.2.0          |           py36_0         528 KB
    six-1.14.0                 |           py36_0          27 KB
    sqlite-3.31.1              |       he774522_0         637 KB
    vc-14.1                    |       h21ff451_1           4 KB  peterjc123
    vs2015_runtime-14.16.27012 |       hf0eaf9b_1         1.1 MB
    vs2017_runtime-15.4.27004.2010|                1         1.6 MB  peterjc123
    wheel-0.34.2               |           py36_0          66 KB
    wincertstore-0.2           |   py36h7fe50ca_0          14 KB
    ------------------------------------------------------------
                                           Total:       476.3 MB

The following NEW packages will be INSTALLED:

  blas               pkgs/main/win-64::blas-1.0-mkl
  certifi            pkgs/main/win-64::certifi-2019.11.28-py36_0
  cffi               pkgs/main/win-64::cffi-1.14.0-py36h7a1dbc1_0
  icc_rt             pkgs/main/win-64::icc_rt-2019.0.0-h0cc432a_1
  intel-openmp       pkgs/main/win-64::intel-openmp-2020.0-166
  mkl                pkgs/main/win-64::mkl-2020.0-166
  mkl-service        pkgs/main/win-64::mkl-service-2.3.0-py36hb782905_0
  mkl_fft            pkgs/main/win-64::mkl_fft-1.0.15-py36h14836fe_0
  mkl_random         pkgs/main/win-64::mkl_random-1.1.0-py36h675688f_0
  numpy              pkgs/main/win-64::numpy-1.18.1-py36h93ca92e_0
  numpy-base         pkgs/main/win-64::numpy-base-1.18.1-py36hc3f5095_1
  pip                pkgs/main/win-64::pip-20.0.2-py36_1
  pycparser          pkgs/main/win-64::pycparser-2.19-py36_0
  python             pkgs/main/win-64::python-3.6.10-h9f7ef89_0
  pytorch            peterjc123/win-64::pytorch-0.3.1-py36_cuda80_cudnn6he774522_2
  setuptools         pkgs/main/win-64::setuptools-45.2.0-py36_0
  six                pkgs/main/win-64::six-1.14.0-py36_0
  sqlite             pkgs/main/win-64::sqlite-3.31.1-he774522_0
  vc                 peterjc123/win-64::vc-14.1-h21ff451_1
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_1
  vs2017_runtime     peterjc123/win-64::vs2017_runtime-15.4.27004.2010-1
  wheel              pkgs/main/win-64::wheel-0.34.2-py36_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py36h7fe50ca_0


Proceed ([y]/n)?y


Downloading and Extracting Packages
mkl-2020.0           | 98.9 MB   | ############################################################################ | 100%
vs2017_runtime-15.4. | 1.6 MB    | ############################################################################ | 100%
python-3.6.10        | 15.9 MB   | ############################################################################ | 100%
sqlite-3.31.1        | 637 KB    | ############################################################################ | 100%
pip-20.0.2           | 1.7 MB    | ############################################################################ | 100%
mkl_fft-1.0.15       | 118 KB    | ############################################################################ | 100%
mkl-service-2.3.0    | 210 KB    | ############################################################################ | 100%
pycparser-2.19       | 171 KB    | ############################################################################ | 100%
certifi-2019.11.28   | 154 KB    | ############################################################################ | 100%
six-1.14.0           | 27 KB     | ############################################################################ | 100%
numpy-1.18.1         | 6 KB      | ############################################################################ | 100%
wincertstore-0.2     | 14 KB     | ############################################################################ | 100%
wheel-0.34.2         | 66 KB     | ############################################################################ | 100%
mkl_random-1.1.0     | 233 KB    | ############################################################################ | 100%
intel-openmp-2020.0  | 1.5 MB    | ############################################################################ | 100%
cffi-1.14.0          | 222 KB    | ############################################################################ | 100%
vc-14.1              | 4 KB      | ############################################################################ | 100%
numpy-base-1.18.1    | 3.8 MB    | ############################################################################ | 100%
setuptools-45.2.0    | 528 KB    | ############################################################################ | 100%
vs2015_runtime-14.16 | 1.1 MB    | ############################################################################ | 100%
pytorch-0.3.1        | 349.3 MB  | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(pytlesson) C:\Users\jklee>
 

Numpy 등  파이토치를 사용용하는데 필요한 라이브러리도 함께 설치한다.



2.3 실습 관련 라이브러리 설치


jupyter : 개발환경 기능을 제공하는 라이브러리

Pillow : 이미지 처리 관련 함수를 제공

Matplotlib: 그래프 작성용 함수를 제공

Pandas : 데이터를 다루는 함수를 제공

Scikit-learn : 머신러닝 관련 함수를 제공

KoNLPy : 자연어 처리용 함수를 제공


(pytlesson) C:\Users\jklee>conda install jupyter                                                

(pytlesson) C:\Users\jklee>conda install pillow 

(pytlesson) C:\Users\jklee>conda install matplotlib  

(pytlesson) C:\Users\jklee>conda install pandas  

(pytlesson) C:\Users\jklee>conda install scikit-learn 

(pytlesson) C:\Users\jklee>pip install konlpy 



모든 라이브러리가 끝나면 윈도우 탐색기를 열어 C:\Anaconda3\envs\pytlesson 폴더를 확인한다.

envs아래를 보면 방금 추가한 파이썬 환경의 이름인 pytlesson이라는 폴더를 확인할 수 있다.



파이토치 설치

 

conda install pytorch-cpu==1.1.0 torchvision-cpu==0.3.0 cpuonly -c pytorch  

 

댓글목록

등록된 댓글이 없습니다.



개인정보취급방침 서비스이용약관
Copyright © www.leelab.co.kr All rights reserved.
상단으로
TEL. 063-469-4551 FAX. 063-469-4560
전북 군산시 대학로 558
군산대학교 컴퓨터정보공학과
PC 버전으로 보기