【tensorflow】anaconda+python3+tensorflow2.1+gpu安装

anaconda+python3+tensorflow2.1+gpu安装

anaconda下载地址(清华源)

https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D

配置镜像加速

在anaconda promote中输入这串,打开配置文件:

notepad %userprofile%/.condarc

在 .condarc 文件中编辑

channels:
  - defaults
show_channel_urls: true
channel_alias: https://anaconda.mirrors.sjtug.sjtu.edu.cn/
default_channels:
  - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/main
  - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/free
  - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/mro
  - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/msys2
  - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/pro
  - https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/r
custom_channels:
  conda-forge: https://anaconda.mirrors.sjtug.sjtu.edu.cn/conda-forge
  soumith: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/soumith
  bioconda: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/bioconda
  menpo: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/menpo
  viscid-hub: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/viscid-hub
  atztogo: https://anaconda.mirrors.sjtug.sjtu.edu.cn/cloud/atztogo

回到anaconda promote
清除以前的索引缓存

conda clean -i

我电脑有装代理,所以可能会出现这个问题

Collecting package metadata (current_repodata.json): failed

ProxyError: Conda cannot proceed due to an error in your proxy configuration.
Check for typos and other configuration errors in any '.netrc' file in your home directory,
any environment variables ending in '_PROXY', and any other system-wide proxy
configuration settings.

解决方案

打开regedit
将"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"的值从1改为0,

改完之后,电脑代理失效,所以anaconda安装完毕后,需要还原回1

在conda中python降级(如果不是3.7版本,则需要执行一下)

查看安装的python版本,我们需要安装3.7的,如果不是的话,,则需要python降级,在conda中执行(很慢)

conda install python==3.7 anaconda=custom

在conda中安装gpu显卡驱动

如果是英伟达显卡,则可以安装tensorflow使用的gpu驱动

conda install cudatoolkit=10.1
conda install cudnn=7.6

安装tensorflow

pip install tensorflow==2.1

PS:conda命令

新建conda虚拟环境
conda create --name tf2  python=3.7

删除conda虚拟环境
conda remove -n your_env_name --all

查看conda里面的环境有哪些
conda info --env

切换conda当前的虚拟环境
conda activate tf2

查看已安装的包
conda list

查询包
conda search package_name

安装包
conda install package_name

指定版本安装包
conda install package_name=1.5.0

更新包
conda update package_name

删除包
conda remove package_name
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值