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