leemengtaiwan
10/20/2017 - 6:25 AM

Conda相關指令

一開始下載的conda package可能是比較舊的版本, 記得更新 Conda 像是pip 一樣可以管理lib, 不過不限於python lib, 也能裝非python lib, 另外numpy, scikit等lib 是使用pre-compiled 的 MKL 版本, 更快. 而且也可以管理虛擬環境, 就像是pyenv

Package download

update conda

$conda upgrade conda
$conda upgrade --all

create python2/3 env for general purpose

$conda create -n py2 python=2
$conda create -n py3 python=3

list all env

$conda info --envs

or

$ conda env list

Activate env

$ME0342:AIND leemeng$ source activate py3
(py3) ME0342:AIND leemeng$ 

requirement / dependency sharing

= pip freeze > requirements.txt

$conda env export > environment.yaml

Install dependencies from file

$conda install --file requirements.txt

Create new env from existing .yaml

$ conda env create -n test -f environment.yaml 

Show dependencies of a env without activation

$conda list -n test

Delete a env

$ conda env remove -n test

List all non-Python package

$conda search --canonical  | grep -v 'py\d\d'

Jupyter notebook

在jupyter notebook 裡頭要切換不同環境,記得想要使用的環境本身要安裝jupyter notebook

conda install jupyter