zoukankan      html  css  js  c++  java
  • Anaconda3(2)Anaconda3中安装TensorFlow

    https://zhuanlan.zhihu.com/p/34730661

    1. 安装anaconda3:自行下载、安装【注意版本】

    (可参考引用链接)

    2. 搭建TensorFlow环境

    cuda10.1

    cudnn10.1

    opencv4.11

    显卡1050ti

    win10

    2.1 输入清华库,更新快一点:

    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    conda config --set show_channel_urls yes
    

      

    2.2 在anaconda中创建TensorFlow环境

    同样在Anaconda Prompt中利用Anaconda创建一个python3.5的环境,环境名称为tensorflow ,输入下面命令:

    3 开始安装

    pip install --ignore-installed --upgrade tensorflow-gpu
    

      

    cuda关系对应表

    https://blog.csdn.net/omodao1/article/details/83241074

    安装tf2.0- python3.6-cuda10.0 不是10.1

    pip install  tensorflow-gpu==2.0
    

      

    安装tf1.4- python3.6-cuda8.0-cudnn6-numpy1.16

    pip install  tensorflow-gpu==1.4
    

      

    测试程序

    #!/usr/bin/python
    # -*- coding: UTF-8 -*-
     
    import sys
    sys.path.append("F:/dongdong/0tool/python/anaconda3/envs/work_cuda8_py36_tf14/Lib/site-packages")
    import numpy
    import tensorflow as tf
    a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
    b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
    c = tf.matmul(a, b)
    sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
    print(sess.run(c))
    

      

    报错两个

    1 安装werkzeug

    2 安装cypthon库

    3问题  里可以发现你可能安装了两个numpy,所以会报错

    我通过从numpy卸载当前版本并通过重新安装最新版本来解决。
    pip uninstall numpy

    pip install numpy

    python -m pip install --upgrade numpy
    

      

    4问题 cuda不对。 10.0和10.1都不行???

     您应该安装Cuda 10.0。如果您安装了Cuda 10.1,将没有文件cudart64_100.dll我重命名cudart64_101.dllcudart64_100.dll,可以正常工作。

    Tensorflow 2.0 - AttributeError: module 'tensorflow' has no attribute 'Session'

    pip install --upgrade pip
    pip install tensorflow==2.0.0-alpha0
    pip install keras
    pip install numpy==1.16.2
    

      

    #!/usr/bin/python
    # -*- coding: UTF-8 -*-
     
    import sys
    sys.path.append("F:/dongdong/0tool/python/anaconda3/envs/work_py36/Lib/site-packages")
    import tensorflow as tf
    hello = tf.constant('Hello, TensorFlow!')
    sess = tf.Session()
    sess.run(hello)
    a = tf.constant(10)
    b = tf.constant(32)
    sess.run(a+b)
    

      成功了

     

  • 相关阅读:
    2017年期末获奖名单
    2018-01-17作业
    3.2.4 条件表达式
    3.2.3if语句的嵌套2
    if嵌套语句--作业题
    软工第四次作业
    软工第五次作业-结对
    软工第三次作业
    软工第二次作业——数独
    软工实践2017年第一次作业
  • 原文地址:https://www.cnblogs.com/kekeoutlook/p/11723119.html
Copyright © 2011-2022 走看看