MINERVA/Python 2022. 7. 1. 05:04
반응형

가상환경을 제공하는 아나콘다(Anaconda)에서 필수적인 명령어를 정리하고자 합니다.

 

1) 버전 확인

[Anaconda Prompt(anaconda3)]

(base) D:\NextTime\cwwDev>conda -V
conda 4.13.0

 

2) 라이브러리(패키지) 설치, 업데이트 그리고 삭제하기

 

2-1) 설치된 라이브러리(패키지) 전체 업데이트

(base) D:\NextTime\cwwDev>conda update --all
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

 

2-2) 라이브러리(패키지) 설치

(base) D:\NextTime\cwwDev>conda install 라이브러리(패키지)명

 

2-3) 부분 업데이트

(base) D:\NextTime\cwwDev>conda update 라이브러리(패키지)명

 

2-4) 라이브러리(패키지) 삭제

(base) D:\NextTime\cwwDev>conda remove 라이브러리(패키지)명

 

3) 설치된 가상환경(virtual environment) 확인

(base) D:\NextTime\cwwDev>conda info --env
# conda environments:
#
base                  *  d:\Dev\anaconda3  <-- 기본 아나콘다 가상환경

 

(base) D:\NextTime\cwwDev>conda env list
# conda environments:
#
base                  *  d:\Dev\anaconda3  <-- 기본 아나콘다 가상환경

 

4) 사용중인 가상환경에 구성된 시스템 정보보기

 

4-1) 64 bit 확인

(base) D:\NextTime\cwwDev>conda info

     active environment : base
    active env location : d:\Dev\anaconda3
            shell level : 1
       user config file : C:\Users\CHOI\.condarc
 populated config files : C:\Users\CHOI\.condarc
          conda version : 4.13.0
    conda-build version : 3.21.9
         python version : 3.8.5.final.0
       virtual packages : __cuda=11.1=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : d:\Dev\anaconda3  (writable)
      conda av data dir : d:\Dev\anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : d:\Dev\anaconda3\pkgs
                          C:\Users\CHOI\.conda\pkgs
                          C:\Users\CHOI\AppData\Local\conda\conda\pkgs
       envs directories : d:\Dev\anaconda3\envs
                          C:\Users\CHOI\.conda\envs
                          C:\Users\CHOI\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.13.0 requests/2.24.0 CPython/3.8.5 Windows/10 Windows/10.0.19041
          administrator : False
             netrc file : None
           offline mode : False

 

4-2) 32 bit 확인

(base) D:\NextTime\cwwDev>set CONDA_FORCE_32BIT=1
(base) D:\NextTime\cwwDev>conda info

     active environment : base
    active env location : d:\Dev\anaconda3
            shell level : 1
       user config file : C:\Users\CHOI\.condarc
 populated config files : C:\Users\CHOI\.condarc
          conda version : 4.13.0
    conda-build version : 3.21.9
         python version : 3.8.5.final.0
       virtual packages : __cuda=11.1=0
                          __win=0=0
                          __archspec=1=x86
       base environment : d:\Dev\anaconda3  (writable)
      conda av data dir : d:\Dev\anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-32
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-32
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-32
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : d:\Dev\anaconda3\pkgs32
                          C:\Users\CHOI\.conda\pkgs32
                          C:\Users\CHOI\AppData\Local\conda\conda\pkgs32
       envs directories : d:\Dev\anaconda3\envs
                          C:\Users\CHOI\.conda\envs
                          C:\Users\CHOI\AppData\Local\conda\conda\envs
               platform : win-32
             user-agent : conda/4.13.0 requests/2.24.0 CPython/3.8.5 Windows/10 Windows/10.0.19041
          administrator : False
             netrc file : None
           offline mode : False

 

5) 가상환경(virtual environment) 만들기

(base) D:\NextTime\cwwDev>conda create -n py39_32 python=3.9
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: d:\Dev\anaconda3\envs\py39_32

  added / updated specs:
    - python=3.9


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2022.4.26  |       haa95532_0         124 KB
    certifi-2022.6.15          |   py39haa95532_0         153 KB
    openssl-1.1.1p             |       h2bbff1b_0         4.8 MB
    pip-21.2.4                 |   py39haa95532_0         1.8 MB
    python-3.9.12              |       h6244533_0        17.1 MB
    setuptools-61.2.0          |   py39haa95532_0         1.0 MB
    sqlite-3.38.5              |       h2bbff1b_0         798 KB
    tzdata-2022a               |       hda174b7_0         109 KB
    vc-14.2                    |       h21ff451_1           8 KB
    vs2015_runtime-14.27.29016 |       h5e58377_2        1007 KB
    wheel-0.37.1               |     pyhd3eb1b0_0          33 KB
    wincertstore-0.2           |   py39haa95532_2          15 KB
    ------------------------------------------------------------
                                           Total:        26.9 MB

The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/win-64::ca-certificates-2022.4.26-haa95532_0
  certifi            pkgs/main/win-64::certifi-2022.6.15-py39haa95532_0
  openssl            pkgs/main/win-64::openssl-1.1.1p-h2bbff1b_0
  pip                pkgs/main/win-64::pip-21.2.4-py39haa95532_0
  python             pkgs/main/win-64::python-3.9.12-h6244533_0
  setuptools         pkgs/main/win-64::setuptools-61.2.0-py39haa95532_0
  sqlite             pkgs/main/win-64::sqlite-3.38.5-h2bbff1b_0
  tzdata             pkgs/main/noarch::tzdata-2022a-hda174b7_0
  vc                 pkgs/main/win-64::vc-14.2-h21ff451_1
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2
  wheel              pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py39haa95532_2

Proceed ([y]/n)?y

....

done
#
# To activate this environment, use
#
#     $ conda activate py39_32
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) D:\NextTime\cwwDev>

 

(base) D:\NextTime\cwwDev>conda env list
# conda environments:
#
base                  *  d:\Dev\anaconda3
py39_32                  d:\Dev\anaconda3\envs\py39_32

 

5) 가상환경(virtual environment) 지우기

(base) D:\NextTime\cwwDev>conda env remove -n py39_32
Remove all packages in environment d:\Dev\anaconda3\envs\py39_32:

 

(base) D:\NextTime\cwwDev>conda env list
# conda environments:
#
base                  *  d:\Dev\anaconda3

 

6) 생성된 가상환경(virtual environment) 활성화 및 비활성화

 

6-1) 활성화

 

(base) D:\NextTime\cwwDev>conda activate py39_32
(py39_32) D:\NextTime\cwwDev>

 

6-2) 비활성화

 

(py39_32) D:\NextTime\cwwDev>conda deactivate
(base) D:\NextTime\cwwDev>

 

7) 생성된 가상환경(virtual environment)에 패키지 설치

7-1) 가상환경(virtual environment) 생성, 진입(활성화), 그리고 설치하기

(base) D:\NextTime\cwwDev>conda activate py39_32

(py39_32) D:\NextTime\cwwDev>pip install pyqt5

(py39_32) D:\NextTime\cwwDev>pip install pykiwoom

 

7-2) 가상환경(virtual environment) 생성하면서 동시에 패키지 설치하기

(base) D:\NextTime\cwwDev>conda create -n py39_32 python=3.9 pyqt5 pykiwoom

 

반응형
posted by choiwonwoo
: