anaconda 常用命令

1. 基本命令

1.环境
创建环境,xx代表你需要的名字

conda create -n xx python==3.6

查看虚拟环境

conda info --env

删除, xx为要删除的虚拟环境的名字

conda remove -n xx --all

2镜像
添加镜像(需要注意你添加的镜像是否还能使用,比如清华在之前有段时间是末)

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/conda-forge/

常用镜像(待补充)

http://pypi.mirrors.ustc.edu.cn/ #中国科学技术大学
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.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
# 设置搜索时显示通道地址
conda config --set show_channel_urls yes

查看当前镜像

conda config --show channels

如果要删除镜像

conda config --remove-key channels #删除所有的镜像源,恢复到默认
or
conda config --remove channels [urls] #删除指定的镜像源

3 tf

TensorFlow-gpu1.14+CUDA10.1+cuDNN7.5.6
在这里插入图片描述
用conda命令会比pip好

conda install tensorflow-gpu==1.14.0

4 torch安装

https://pytorch.org/get-started/previous-versions/ 查看torch与cuda版本对应关系:(我这里是CUDA 10.1)

pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

有时候需要离线安装一些包(whl,tar(install这个的时候末尾要加bz2)后缀的压缩包)

onda install C:\Users\dell\Downloads\pytorch-1.9.1-py3.8_cuda11.1_cudnn8_0.tar.bz2

numpy 和scipy

一般来说numpy可以正常安装成功,而scipy有很大概率失败,原因是scipy要依赖于numpy和其他的很多库(如LAPACK/BLAS),但这些库在windows下并不是可以简单获取的,详情参见这里:Building From Source on Windows

不过,经过查找,发现可以通过另外一个方式解决,即上面某些答主提到的一个非官方维护的第三方库在Windows下的处理:http://www.lfd.uci.edu/~gohlke/pythonlibs/
https://download.pytorch.org/whl/torch_stable.html
https://pypi.tuna.tsinghua.edu.cn/simple/numpy/

pip install numpy-1.19.5+mkl-cp37-cp37m-win_amd64.whl
pip install scipy-1.7.3-cp37-cp37m-win_amd64.whl
numpy→scipy→matplotlib→sklearn

在这里插入图片描述
在线安装 第一个网站为url,第二个网址为镜像

pip install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.doubanio.com/simple

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值