갈루아의 반서재

728x90

아나콘다 환경에서 설치된 패키지를 제거하는 방법은 다음과 같습니다.

아래 설치된 cx_oracle 패키지를 제거해보겠습니다.

(pyenv) founder@merrow:~/pyenv$ conda list
# packages in environment at /home/founder/anaconda3/envs/pyenv:
#
# Name                    Version                   Build  Channel
ca-certificates           2019.1.23                     0    anaconda
certifi                   2018.11.29               py27_0    anaconda
cx_oracle                 7.0.0            py27h7b6447c_0    anaconda

아래와 같이 conda remove 명령으로 패키지 제거가 가능합니다. 형식은 다음과 같습니다. 간단하게 이 정도만 기억하시면 될 것 같은데요.

conda  remove [-n  ENVIRONMENT] [package_name]

특정 아나콘다 환경의 패키지를 삭제하는 명령입니다.

더 자세한 옵션은 아래 링크에서 확인하실 수 있습니다.

conda remove https://veranostech.github.io/docs-korean-conda-docs/docs/build/html/commands/conda-remove.html

(pyenv) founder@merrow:~/pyenv$ conda remove -n pyenv cx_oracle Solving environment: done ==> WARNING: A newer version of conda exists. <== current version: 4.5.12 latest version: 4.6.8 Please update conda by running $ conda update -n base -c defaults conda ## Package Plan ## environment location: /home/founder/anaconda3/envs/pyenv removed specs: - cx_oracle The following packages will be downloaded: package | build ---------------------------|----------------- certifi-2019.3.9 | py27_0 155 KB ca-certificates-2019.1.23 | 0 126 KB ------------------------------------------------------------ Total: 281 KB The following packages will be REMOVED: cx_oracle: 7.0.0-py27h7b6447c_0 anaconda The following packages will be UPDATED: ca-certificates: 2019.1.23-0 anaconda --> 2019.1.23-0 certifi: 2018.11.29-py27_0 anaconda --> 2019.3.9-py27_0 The following packages will be DOWNGRADED: openssl: 1.1.1-h7b6447c_0 anaconda --> 1.1.1b-h7b6447c_1 Proceed ([y]/n)? y Downloading and Extracting Packages certifi-2019.3.9 | 155 KB | ############################################################### | 100% ca-certificates-2019 | 126 KB | ############################################################### | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done (pyenv) founder@merrow:~/pyenv$ conda list # packages in environment at /home/founder/anaconda3/envs/pyenv: # # Name Version Build Channel ca-certificates 2019.1.23 0 certifi 2019.3.9 py27_0

해당 아나콘다 환경을 활성화한 상황에서는 아래와 같이 간단히 패키지 이름만 입력해도 제거할 수 있습니다. 아래와 같이 가상환경에 들어간 상황에서는 굳이 [-n  ENVIRONMENT] 는 명시하지 않아도 됩니다.  

(pyenv) founder@merrow:~/pyenv$ conda remove cx_oracle
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.5.12
  latest version: 4.6.8

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /home/founder/anaconda3/envs/pyenv

  removed specs:
    - cx_oracle


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2019.1.23  |                0         126 KB

The following packages will be REMOVED:

    cx_oracle:       7.0.0-py27h7b6447c_0 anaconda

The following packages will be UPDATED:

    ca-certificates: 2019.1.23-0          anaconda --> 2019.1.23-0
    certifi:         2018.11.29-py27_0    anaconda --> 2019.3.9-py27_0

The following packages will be DOWNGRADED:

    openssl:         1.1.1-h7b6447c_0     anaconda --> 1.1.1b-h7b6447c_1

Proceed ([y]/n)? y


Downloading and Extracting Packages
ca-certificates-2019 | 126 KB    | ############################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(pyenv) founder@merrow:~/pyenv$

물론 아나콘다 비활성화 상태에서는 -n pyenv 와 같이 환경이름을 특정함으로써 해당 환경의 특정 페키지를 제거할 수 있습니다.

founder@merrow:~/pyenv$ conda remove -n pyenv cx_oracle
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.5.12
  latest version: 4.6.8

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /home/founder/anaconda3/envs/pyenv

  removed specs:
    - cx_oracle


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2019.1.23  |                0         126 KB

The following packages will be REMOVED:

    cx_oracle:       7.0.0-py27h7b6447c_0 anaconda

The following packages will be UPDATED:

    ca-certificates: 2019.1.23-0          anaconda --> 2019.1.23-0
    certifi:         2018.11.29-py27_0    anaconda --> 2019.3.9-py27_0

The following packages will be DOWNGRADED:

    openssl:         1.1.1-h7b6447c_0     anaconda --> 1.1.1b-h7b6447c_1

Proceed ([y]/n)? y


Downloading and Extracting Packages
ca-certificates-2019 | 126 KB    | ############################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
founder@merrow:~/pyenv$ source activate pyenv
(pyenv) founder@merrow:~/pyenv$ conda list
# packages in environment at /home/founder/anaconda3/envs/pyenv:
#
# Name                    Version                   Build  Channel
ca-certificates           2019.1.23                     0
certifi                   2019.3.9                 py27_0
Django                    1.9.5                     
django-bootstrap-calendar 0.1.0                     
jsmin                     2.2.1                     
libedit                   3.1.20181209         hc058e9b_0
libffi                    3.2.1                hd88cf55_4
libgcc-ng                 8.2.0                hdf63c60_1
libstdcxx-ng              8.2.0                hdf63c60_1
ncurses                   6.1                  he6710b0_1
openssl                   1.1.1b               h7b6447c_1
pip                       19.0.3                   py27_0
python                    2.7.15               h9bab390_6

그리고 비활성화 상태에서 아나콘다 환경명을 특정하지 않으면 해당 패키지를 제거할 수 없으니 주의하세요. 

founder@merrow:~/pyenv$ conda remove cx_oracle
Solving environment: failed

PackagesNotFoundError: The following packages are missing from the target environment:
  - cx_oracle
이외에 conda clean 이라는 명령도 있는데, 이는 사용하지 않는 패키지나 캐시를 제거할 때 사용됩니다. 상세한 내용은 아래를 참고하세요.

conda clean https://veranostech.github.io/docs-korean-conda-docs/docs/build/html/commands/conda-clean.html



728x90