conda 命令整理-Linux

注意:

Ubuntu16.04下Anaconda安装完成后conda:找不到命令

键入下述:

echo 'export PATH="/home/whut/anaconda2/bin:$PATH"' >> ~/.bashrc

source ~/.bashrc

然后再尝试。

1)版本查看:

conda -V

2)列举所有环境:

conda info --envs
conda env list

3)创建环境:

conda create --name your_env_name
conda create --name your_env_name python=2.7
conda create --name your_env_name python=3
conda create --name your_env_name python=3.5

4)进入某个环境:

source activate env_name

5)退出当期环境:

source deactivate

6)列出当期活跃环境下的所有包:

conda list

7)确认一下python2.7和pip是否位于当前环境:

which python2.7

which pip

8)常用命令:

u'info', u'help', u'list', u'search', u'create', u'install', u'update', u'upgrade', u'remove', u'uninstall', u'config', u'clean', u'package')

eg:安装命令:

conda install numpy

9) 添加conda国内镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

# 也可选用科大conda镜像
conda config --prepend channels http://mirrors.ustc.edu.cn/anaconda/pkgs/free/

查看镜像源是否安装成功:
conda config --set show_channel_urls yes

会生成一个~/.condarc文件,运行cat命令可以查看相关内容

cat ~/.condarc

显示内容:

 - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
show_channel_urls: true

如果报错下,且查看源如上, 那么需要删除defaults。

 

10)删除某个环境:root环境下运行

conda remove --name your_env_name --all


 

猜你喜欢

转载自blog.csdn.net/juwenkailaodi/article/details/85543962