zoukankan      html  css  js  c++  java
  • Tensorflow 安装和测试(Anaconda4.7.10+windows10)

    一. 软件下载

    二. 配置相关

    1. 修改 Jupyter notebook 默认工作路径

      (1)打开 Anaconda Prompt ,输入 jupyter notebook --generate-config,打开文件 C:Usersxxx.jupyterjupyter_notebook_config.py ,修改 c.NotebookApp.notebook_dir = 'G:StudyFilesPythonProjects'

      (2)修改快捷方式的启动路径

    2. 配置conda镜像源(参考 https://blog.csdn.net/Sagepyt/article/details/100740862

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

    3. conda常用的命令

     1)conda list 查看安装了哪些包。
        2)conda env list 或 conda info -e 查看当前存在哪些虚拟环境
        3)conda update conda 检查更新当前conda

    4.创建python虚拟环境
    conda create -n your_env_name python=X.X

    5.删除虚拟环境
    conda remove -n your_env_name(虚拟环境名称) --all

    6.删除环境中的某个包
    conda remove --name your_env_name  package_name

    7.jupyter-notebook添加python虚拟环境
    conda install -n tensorflow ipykernel

    8.生成ipykernel的配置文件(–name之后跟的是在jupyter-notebook中对应虚拟环境的kernel名称)
    python -m ipykernel install --name tensorflow-notebook

    9.测试代码

    import tensorflow as tf
    tf.compat.v1.disable_eager_execution()   # The Session graph is empty.  Add operations to the graph before calling run().
    sess = tf.compat.v1.Session()
    matrix1 = tf.constant([[3., 3.]])
    matrix2 = tf.constant([[2.],[2.]])
    product = tf.matmul(matrix1, matrix2)
    result = sess.run(product)
    print(result)
    
  • 相关阅读:
    图片放大镜
    带左右箭头切换的自动滚动图片JS特效
    jquery网站左侧弹出导航菜单
    网页滚动到底部自动加载
    php访问方法外变量
    图片上传预览
    GET方式,获取服务器文件
    php 邮件发送代码-php邮件群发
    java正则
    sql之left join、right join、inner join的区别
  • 原文地址:https://www.cnblogs.com/runningRain/p/12626571.html
Copyright © 2011-2022 走看看