三分钟快速搭建conda虚拟环境

距离上一次python环境搭建已经好几年了,在这此搭建环境中又遇到了不少坑,(好像以前也也到过,时间久了就忘记了),为了避免重复造车,特此整理一下步骤,以供下次使用。

1、首先安装anaconda(原网址https://www.anaconda.com/下载缓慢,建议清华镜像)

2、prompt下恢复默认镜像源:

conda config --remove-key channels

3、创建python3.7虚拟环境(必须在步骤2的前提下才能创建成功):

conda create -n py3 python=3.7//创建py3.7版本的虚拟环境

4、激活创建的虚拟环境:

activate py3

5、更改虚拟环境下的下载镜像源:

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

6、py3下安装pip包:

conda install pip

7、py3下安装tensorflow包

conda install tensorflow

8、py3下安装web flask包

conda install flask

9、py3下安装opencv包

conda install opencv

ps:

如果一切顺利的话,安装完上述只需要10分钟左右。如果有遇到网络问题导致安装包失败的问题,可以去以下两个网址进行下载安装:

  1. https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
  2. https://www.lfd.uci.edu/~gohlke/pythonlibs/(ctrl+F快速查找包)

例如:由于opencv库的安装比较复杂,如果安装失败,可以直接安装其他程序人员编译好的.whl安装文件。

离线安装:

pip install c://xxx/ccc/xxx.whl

具体的细节可以看我的另一篇博文:

https://blog.csdn.net/l641208111/article/details/83863173

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DLANDML

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值