在Jupyter Notebook中使用Tensorflow-1.13.1(cpu版本)

说明:已安装anaconda 3,Windows10系统
下载过慢可以输入一下代码载入清华镜像:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
三段代码分三次输入并执行。
如果需要使用pytorch,需要添加新的源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch

  1. 打开 Anaconda Prompt

  2. python -m pip install --upgrade pip # 升级 pip

  3. conda create -n tensorflow python=3.6 # 创建虚拟环境tensorflow
    conda info --envs # 检查虚拟环境是否安装

  4. activate tensorflow #(激活切换到虚拟环境tensorflow)
    conda deactivate # 退出激活环境

  5. 在虚拟环境下安装 tensorflow:
    pip install tensorflow==1.13.1 -i https://pypi.tuna.tsinghua.edu.cn/simple/

  6. 输入python进入python编辑环境
    依次输入以下代码检查tensorflow安装是否完成:

     import tensorflow as tf
     hello = tf.constant("hello,tensorflow!")
     sess = tf.Session()
     print(sess.run(hello)
    

    输出结果:b’hello,tensorflow!’
    exit()退出python编辑环境

  7. conda install ipython # 在虚拟环境下安装ipython

  8. 然后安装ipykernel: pip install ipykernel

  9. 最后将此kernel链接到jupyter notebook中 :
    python -m ipykernel install --user --name tensorflow --display-name "TensorFlow 1.13.1"

  10. 输入jupyter notebook 打开jupyter -> new -> TensorFlow 1.13.1,输入以下代码检查安装
    在这里插入图片描述

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值