conda虚拟环境安装库_快速创建conda虚拟环境和安装库文件

步骤

新建虚拟环境,名为tf2,python版本3.6

注:如果不加镜像链接,创建将很慢.

conda create --name tf2 python=3.6 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

进入虚拟环境tf2并使用pip安装库文件,比如安装opencv和tensorflow

conda activate

pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple

退出当前虚拟环境

conda deactivate

再比如安装pytorch:

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

上述命令已经安装了对应的cuda版本10.1,则还需要安装cudnn,命令如下:

conda install cudnn=7.6.5

之后通过命令查看安装的库以及版本信息:

conda list

如果闲麻烦,可以直接打开终端,分别执行下面命令,然后再去安装库文件

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 --set show_channel_urls yes

关于虚拟环境的其它操作可参考:conda虚拟环境创建和管理

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值