Conda常用的命令总结


The following commands all comes frome the url (the official website of conda):

please click the portal if u want to check the commands of conda from official websit

1.Conda Management

Show the version of conda

conda --version
# or
conda -V

Check more info about Conda

conda info

Updata Conda

conda update conda

2. Manage the virtual enviroment

Show the info of help about conda create

conda create --help

Create vitual enviroment

# envname :the name of the env u want to create
conda create --name envname
#The env u created will be stored in the **location of conda/env**

Delete the vitual env

conda remove -n envname --all

Create the specific version of python of other pacakges

# indicate python version
conda create -n envname python=3.4
# indicate the specific pacakge 
conda create -n envname scipy=0.15.0
# indicate the python version & mutiple pacakges 
conda create -n envname python=3.7 scipy 

Install pacakges for virtual env

conda install -n envname scipy=0.15.0

If you want to install specific pacakges when creating a new env , you can make it by modifying the file .condarc

Clone a env

conda create --name clone_env --clone envname

Show all envs

conda info --envs

Create a same Conda env (not bying clone)

# View the info of packages
conda list --explicit 
# export the info to current catalog
conda list --explicit > spec-file.txt
# use the file to build the same env like former
conda create --name newenv --file spec-file.txt
# use the packages-info-file to install pacakges in a already existed env
conda install --name newenv --file spec-file.txt

Activate a new env

# for windows:
activate envname #use command ' deactivate ' to quit the env
# for Linux & Macos
source activate envname #use command 'source deactivate ' to quit the env

View the pacakges list

conda list
conda list -n envame
conda list -n envname numpy

Use pip

conda install -n envname pip
source activate envname
pip <pip_subcommand>

3. Share ur env

To realize by generate a enviroment.yml file

conda env export > enviroment.yml
u can also write a yml file like below
name: stats
dependencies:
  - numpy
  - pandas
# a more complex version
name:stats2
channels
  - javascript
dependencies:
  - python=3.4
  - flask
  - pip:
    - Flask-Testing
u can also use the method below to exclude default channel
channels:
  - javascript
  - nodefaults

4. 通道管理

# add a new channel *new_channel* to top of the channel list
conda config --add channels new_channel
#or
conda cofig prepend channels new_channel
# add a new channel *new_channel* to bottle of the channel list
conda cofig --append channels new_channel
# Show channel situation
conda config --set show_channel_urls yes

5.卸载Anaconda

1.找到自己安装的目录,删除整个目录

sudo rm -rf username/anaconda3

2.修改配置文件

(1) 修改bash的用户文件
#修改配置文件
vim ~/.bashrc  #如果你的配置文件为个人的
vim /etc/profile  #如果你的配置文件在系统文件中
#删除如下语句
export PATH=username/anaconda3/bin:$PATH
#最后更新你的配置文件
source ~/.bashrc 或者 source /etc/profile

3.最后关闭终端然后重启即可

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 --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值