본문 바로가기
IT(Tip)

[python] 아나콘다(Anaconda) 가상환경 생성, 업데이트, 삭제하기

by good4me 2020. 9. 1.

goodthings4me.tistory.com

 

Windows 10 환경에서 Anaconda 가상환경 생성, 환경 확인, 설치 패키지 리스트를 확인하고 Spyder를 설치함

 

■ anaconda 가상환경 생성하기
- anaconda prompt를 관리자 권한으로 실행

# myenv38 : 가상환경 이름(원하는 이름으로 사용함)
# python=3.8 : 파이썬 3.8 버전으로 가상환경 생성(원하는 버전 설치 가능)

(base) C:\>conda create --name myenv38 python=3.8

Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##
  environment location: C:\anaconda3\envs\myenv38
  added / updated specs:
    - python=3.8

The following NEW packages will be INSTALLED:
  ca-certificates    pkgs/main/win-64::ca-certificates-2020.7.22-0
  certifi            pkgs/main/win-64::certifi-2020.6.20-py38_0
  openssl            pkgs/main/win-64::openssl-1.1.1g-he774522_1
  pip                pkgs/main/win-64::pip-20.2.2-py38_0
  python             pkgs/main/win-64::python-3.8.5-he1778fa_0
  setuptools         pkgs/main/win-64::setuptools-49.6.0-py38_0
  sqlite             pkgs/main/win-64::sqlite-3.33.0-h2a8f88b_0
  vc                 pkgs/main/win-64::vc-14.1-h0510ff6_4
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_3
  wheel              pkgs/main/noarch::wheel-0.35.1-py_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py38_0
  zlib               pkgs/main/win-64::zlib-1.2.11-h62dcd97_4

Proceed ([y]/n)? y  <---------------------------- 설치 확인 여부 입력
-------------------
done
#
# To activate this environment, use
#
#     $ conda activate myenv38
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) C:\>

 

good4me.co.kr

 

 anaconda 버전 확인

(base) C:\>conda --version 
conda 4.8.4 

 

 가상환경 설치 폴더 확인하기

(myenv38) C:\>conda info --envs    <-------------- 입력

# conda environments:
#
base                     C:\anaconda3
myenv38               *  C:\anaconda3\envs\myenv38
pycharm                  C:\anaconda3\envs\pycharm


(myenv38) C:\>conda info    <-------------- 입력

     active environment : myenv38
    active env location : C:\anaconda3\envs\myenv38
            shell level : 2
       user config file : C:\Users\hxxmi\.condarc
 populated config files :
          conda version : 4.8.4    <--------------------- 아나콘다 버전 
    conda-build version : 3.18.11
         python version : 3.8.5.final.0   <-------------- 파이썬 버전
       virtual packages : __cuda=10.2
       base environment : C:\anaconda3  (writable)
           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 : C:\anaconda3\pkgs
                          C:\Users\hxxmi\.conda\pkgs
                          C:\Users\hxxmi\AppData\Local\conda\conda\pkgs
       envs directories : C:\anaconda3\envs
                          C:\Users\hxxmi\.conda\envs
                          C:\Users\hxxmi\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.8.4 requests/2.24.0 CPython/3.8.5 Windows/10 Windows/10.0.19041
          administrator : True
             netrc file : None
           offline mode : False

(myenv38) C:\>

 

 가상환경 활성화하기

(base) C:\>conda activate myenv38
(myenv38) C:\>    <------------------ 프롬프트 바뀜

 

 conda 패키지 리스트 확인

(myenv38) C:\>conda list
# packages in environment at C:\anaconda3\envs\myenv38:
#
# Name                    Version                   Build  Channel
ca-certificates           2020.7.22                     0
certifi                   2020.6.20                py38_0
openssl                   1.1.1g               he774522_1
pip                       20.2.2                   py38_0
python                    3.8.5                he1778fa_0
setuptools                49.6.0                   py38_0
sqlite                    3.33.0               h2a8f88b_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_3
wheel                     0.35.1                     py_0
wincertstore              0.2                      py38_0
zlib                      1.2.11               h62dcd97_4

(myenv38) C:\>

# conda spyder 없음

 

 conda 패키지 설치 (spyder 설치)

myenv38) C:\>conda install spyder

# 설치 진행과정 생략 

 

가상환경 삭제하기

(base) C:\WINDOWS\system32>conda remove --name myenv38 --all

Remove all packages in environment C:\anaconda3\envs\myenv:

## Package Plan ##

  environment location: C:\anaconda3\envs\myenv

The following packages will be REMOVED:

  ca-certificates-2020.7.22-0
  certifi-2020.6.20-py38_0
  openssl-1.1.1g-he774522_1
  pip-20.2.2-py38_0
  python-3.8.5-he1778fa_0
  setuptools-49.6.0-py38_0
  sqlite-3.33.0-h2a8f88b_0
  vc-14.1-h0510ff6_4
  vs2015_runtime-14.16.27012-hf0eaf9b_3
  wheel-0.35.1-py_0
  wincertstore-0.2-py38_0
  zlib-1.2.11-h62dcd97_4

Proceed ([y]/n)?   <------------------- 'y' 입력하면 삭제 시작됨

 

댓글