Anaconda 中的一些常用命令和镜像源

镜像源

Windows下使用:

中科大的镜像源:

conda config --remove-key channels
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple

清华大学的镜像源:

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

恢复默认源:

conda config --remove-key channels

anaconda中的命令行

新手在接触anaconda时往往不知道如何通过命令行执行一些常用的操作。
下面盘点一些容易记住且在cmd命令行窗口中常用的命令

1.查看anaconda中的所有环境

conda info --envs

将会显示你所拥有的环境以及路径

2.创建环境

conda create -n your_env python==3.x

your_env :你想要创建的环境的名称
Python==3.x用于指定新环境下,你需要安装哪个版本的python,目前基本上是3.6以上了

3.管理环境

(1)创建新环境

激活并进入your_env这个环境.

conda activate your_env

若单击Anaconda Prompt进入命令行窗口,默认环境是base,当你想要进入你新创建的环境时可省略conda

(2)从新环境中退出

当你想要从your_env这个环境退回到root环境时,输入以下命令

conda deactivate your_env
(3)删除环境

删除环境your_env以及环境下所安装的第三方包时,输入以下命令

conda remove -n your_env -all

3.环境包管理

(1)安装某个包

如numpy

conda install numpy

或者

pip install numpy

当需要安装常用的一些包时,有一个比较懒的办法

conda install anaconda 

这样可以安装anaconda平台上自带的一些包

(2)搜索某个包
conda search numpy 

用于搜索anaconda这个平台上的numpy包

(3)查询已有包
conda list

可以查询到该环境中已经安装的包的信息(版本号和所基于的python版本)

安装jupyter notebook

conda install jupyter notebook

必要时利用pip 安装插件部分

pip install jupyter_contrib_nbextensions

卸载jupyter

一般在
C:\Users\xxx\AppData\Local\Programs\Python\Python38\Scripts
卸载方式

pip uninstall -y jupyter
pip uninstall -y jupyter_core
pip uninstall -y jupyter-client
pip uninstall -y jupyter-console
pip uninstall -y notebook
pip uninstall -y qtconsole
pip uninstall -y nbconvert
pip uninstall -y nbformat
pip uninstall -y jupyter-packaging
pip uninstall -y jupyter-server
conda uninstall -y jupyter
conda uninstall -y jupyter_core
conda uninstall -y jupyter-client
conda uninstall -y jupyter-console
conda uninstall -y notebook
conda uninstall -y qtconsole
conda uninstall -y nbconvert
conda uninstall -y nbformat
conda uninstall -y jupyter-packaging
conda uninstall -y jupyter-server
  • 12
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值