Mac系统安装miniconda搭建深度学习环境

下载Miniconda

Miniconda的官网:https://docs.conda.io/en/latest/miniconda.html

官网下载速度慢,直接去清华镜像网站下载红框,框出来的版本:https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/
在这里插入图片描述

安装Miniconda

将下载好的Miniconda文件放到home目录下
在这里插入图片描述
出现许可协议,如下图:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

提示:安装需要时间,请耐心等待

在这里插入图片描述
在这里插入图片描述

虚拟环境常用操作

更换国内源

执行:vim .condarc,将以下内容复制到.condarc文件中

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

在这里插入图片描述
在这里插入图片描述

vim操作命令请参考:https://blog.csdn.net/qq_28168421/article/details/85241669

创建虚拟环境

指令:conda create -n tf2 python=3.6 -y在这里插入图片描述

查看虚拟环境

指令:conda env list
在这里插入图片描述

激活虚拟环境

指令:source activate tf2
在这里插入图片描述

安装函数库

指令:pip install numpy,安装numpy
在这里插入图片描述
如果下载速度较慢,可以采用下面的安装命令,采用国内的阿里源

pip install numpy -i "https://mirrors.aliyun.com/pypi/simple"
退出虚拟环境

指令:conda deactivate
在这里插入图片描述

常用函数库安装

numpy==1.16.0
pandas
matplotlib
opencv-python
opencv-contrib-python
pillow
sklearn
scipy==1.4.1
jupyter
absl-py==0.7
notebook
tensorflow==2.3
tensorflow_datasets
torch==1.6.0
torchvision==0.7.0
-i "https://mirrors.aliyun.com/pypi/simple"

同时安装多个函数库

创建一个txt文件,命名为requirements.txt
在这里插入图片描述
在这里插入图片描述

此图只作为参考

wq退出并保存

在终端执行指令:pip install -r requirements.txt
在这里插入图片描述

其他操作

缺少函数库报错的解决方案

举例说明,缺少什么函数库,就安装什么即可,如下图所示:在这里插入图片描述

删除虚拟环境

指令:conda remove -n tf2 --all
在这里插入图片描述

此操作了解即可,不必操作,一般是不会删除虚拟环境的

到这里利用miniconda搭建深度学习环境就结束了,如果有哪里错误或者更好的方法,欢迎大家留言_

  • 5
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值