• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Anaconda ---相关命令

武飞扬头像
qq_2276764906
帮助1

前言:win R 进入命令行窗口

查看Anaconda环境是否安装成功

conda -V

conda创建、激活、使用、关闭、克隆 虚拟环境

activate        // 激活anaconda,进入base
conda create -n py37 python = 3.7         //创建名为py37,版本为3.7的python环境
conda activate py37          //激活python3.7环境,进入py37环境
python          //查看该环境下python的版本,并计入python控制台
exit ()      //退出python控制台
conda deactivate      //退出当前虚拟的环境,回到base环境中
conda create -n BBB --clone AAA   //克隆环境 本地已有一个环境AAA,若需要创建一个同样的BBB 

查看cuda版本

nvcc -V

查看已有的虚拟环境

conda env list

删除虚拟环境

conda remove -n name  --all

查看已安装的包

conda list      //查看已有的包
conda list numpy      //查看指定包

安装卸载包

conda install xxx   //安装xxx包
conda install scikit-learn=0.23.1      //eg:安装0.23.1版本的scikit-learn
conda uninstall xxx   //卸载xxx包
//这个命令时不时会出一些问题,卸载失败,就可以尝试以下两种卸载命令
conda remove XXX
pip uninstall  XXX

升级包

conda update xxx

conda缓存清理(conda报错segment fault的时候就是需要清理缓存哦)

conda clean -p      //删除没有用的包
conda clean -t      //删除tar包
conda clean -y --all //删除所有的安装包及cache

conda下载包是通过一些chanel来访问下载的

查看chanel

conda config --show

添加chanel

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

删除chanel

conda config –remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda搜索某个包及可安装的版本信息(以scikit-learn包为例)

conda list                    #查看目前以安装的包
conda search scikit-learn     #查看scikit-learn是否可安装

镜像源

常见镜像源

http://mirrors.aliyun.com/pypi/simple/             #阿里
https://pypi.tuna.tsinghua.edu.cn/simple/          #清华
http://pypi.douban.com/simple/                     #豆瓣
http://pypi.mirrors.ustc.edu.cn/simple/            #中国科学技术大学

查看anaconda中已经存在的镜像源

conda config --show channels

删除之前的镜像源,恢复默认状态

conda config --remove-key channels

添加镜像源(待验证)

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/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/
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/cloud/msys2/

设置搜索时显示通道地址

conda config --set show_channel_urls yes

若不想按照上述步骤添加镜像,可使用以下命令直接指定安装时使用的镜像地址(以opencv为例)

conda install opencv -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

指定源使用

pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple      //numpy在国内的站点下载爬虫中的numpy库(第三方库)

待补充完善…

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgceiik
系列文章
更多 icon
同类精品
更多 icon
继续加载