conda基本操作


准备环境

# 下载并安装conda基础环境 $ wget https://mirror.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-4.3.11-Linux-x86_64.sh $ bash Miniconda3-4.3.11-Linux-x86_64.sh -b -p /export/biaoge/conda-test/python # 配置conda隔离环境 $ export PATH=/export/biaoge/conda-test/python/bin:$PATH $ export LD_LIBRARY_PATH=/export/biaoge/conda-test/python/lib:$LD_LIBRARY_PATH # 查看conda和默认的python版本 $ conda --version conda 4.3.11 $ python --version Python 3.6.0 :: Continuum Analytics, Inc. 

常用命令

常用命令一般是业务用户用的比较多,比如更改channel,下载/删除/更新conda包等之类的操作。

conda config 命令

# 使用conda config --show获取当前环境的配置信息(如下输出只列出比较重要的信息) # conda config 信息默认会以yaml格式(也可以增加--json参数)进行输出。输出中显示了默认的channel以及当前在使用的channel # 需要注意的,通常来说国内的网络到默认的源会比较慢,建议第一时间切换为国内源或者私有源 $ conda config --show .... channel_alias: https://conda.anaconda.org channel_priority: True channels: - defaults .... default_channels: - https://repo.continuum.io/pkgs/free - https://repo.continuum.io/pkgs/r - https://repo.continuum.io/pkgs/pro ... # 只显示channels信息 $ sh-4.2# conda config --show-sources ==> /export/python2.7/.condarc <== channels: - https://mirror.tuna.tsinghua.edu.cn/anacondafree - https://mirror.tuna.tsinghua.edu.cn/anaconda/main show_channel_urls: True # 使用conda config其他命令更改channel(config参数都是K/V形式的) # 删除默认的channel,并增加国内清华的conda源 $ conda config --remove channels defaults $ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ $ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ # 将自定的config信息写入当前conda环境的配置文件(使用--system参数默认存放在conda家目录的.condarc文件) $ conda config --system --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ $ cat cat /export/biaoge/conda-test/python/.condarc channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ # 设置其他参数(是否开启每次安装时进行确认安装) $ conda config --set always_yes false # 从channel中安装包时不显示channel的url(一般不建议为no,因为要识别不同channel的包) $ conda config --set show_channel_urls no 

conda install 命令

conda remove 命令

conda update 命令

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM