Tensorflow的安装

  • 环境

    • windows10
    • Anaconda3
  • 安装Tensorflow

    • 打开Anaconda Prompt输入
    conda install tensorflow-gpu
    
    • 或者cmd
    python -m pip install tensorflow-gpu
    
  • 下载并安装CUDA

    • 这边我用的是CUDA9.0版本,所以可以去这个网站下载
    • 安装路径我就直接放在C盘了
    • 然后去下载cuDNN
    • 然后解压并将其对应文件夹中的文件

      放入到先前下载的CUDA的对应文件中如下图所示
  • 测试以及报错

    • 然后尝试用cmd输入
    python
    import tensorflow as tf
    

    • 然后很大可能会出现如下的报错
    lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from
    `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type
    `.   from ._conv import register_converters as _register_converters
    

    Solution:
    可以参考以下两个博客 1.https://blog.csdn.net/qq_41185868/article/details/80276847?utm_source=copy
    2.https://blog.csdn.net/guangli_r/article/details/80860406

    如果还有其他报错的话可以去Tensorflow官网查看解决办法

    最后验证一下安装效果:


```
python
import tensorflow as tf
tf.enable_eager_execution();
print(tf.reduce_sum(tf.random_normal([1000, 1000])));
```
结果:
![](https://img2018.cnblogs.com/blog/1331041/201903/1331041-20190316193650592-1604386319.png)
posted @ 2019-03-16 19:21  Drake丶  阅读(215)  评论(0编辑  收藏  举报