看了很多教程之后,决定采用anconda来安装tensorflow,因为都说gpu的版本速度更快,所以选择gpu版本。
下面详细介绍在win10的配置情况
Nvidia ----- Geforce MX150
怎么看电脑是否有GPU
在开始中找到并打开NVIDIA控制面板(或桌面右键)有NVIDIA控制面板则有GPU
点开,找到帮助菜单,在下拉的菜单里选择系统信息选项,
在弹出的系统信息窗口里有两个菜单页面:显示和组件,选择组件,可以看到很多文件名,在文件名中找到NVCUDA,在产品名称一列可以看到该NVCUDA的版本
(but,好像版本低于看到的版本也没有问题,博主就是;高于就不行了)
选定对应版本,开始安装
CUDA:https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html
cuDNN:https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installwindows
如上链接,安装即可
再安装anconda,因为很大!!所以建议,用清华源安装(网上有很多)
最后是安装tf,,吃了很多苦,我哭
先是安装成了cpu版本,之后又……
最后终于成功了呜呜呜
说一下踩坑
1、请一定记住对应版本!!!包括cpu还是GPU 包括1.0还是2.0
pip install tensorflow-gpu==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
这种是gpu 2.0的标准格式,(改版本即可)
安装好了之后,进入python
import tensorflow
报错……
主要是版本tf和numpy不匹配
```cpp
D:\anconda\envs\tfenv\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
D:\anconda\envs\tfenv\lib\site-packages\tensorflow\python\framework\dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
D:\anconda\envs\tfenv\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
D:\anconda\envs\tfenv\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
D:\anconda\envs\tfenv\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
D:\anconda\envs\tfenv\lib\site-packages\tensorflow\python\framework\dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])```
所以我们需要改变numpy的版本
pip install numpy==1.16.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
OK了
分享国内源
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
https://pypi.tuna.tsinghua.edu.cn/simple 清华源
豆瓣:http://pypi.douban.com/simple/