Anaconda和TensorFlow安装且在Jupyter上运行

1.Anaconda安装及Jupyter使用步骤

https://www.bilibili.com/video/av42143495
是一个五分钟的视频,简洁明了,亲测成功

2.Windows环境下安装TensorFlow

打开Anaconda Prompt
在这里插入图片描述
因为po安装的是默认Python3.7,在命令行输入如下,建立一个 conda 计算环境,命名为tensorflow

(base) C:\Users\USER>conda create -n tensorflow python=3.7

激活这个环境,使用 conda 安装 tensorflow,输入如下

(base) C:\Users\USER>activate tensorflow

以后都可以通过这个命令进入tensorflow的环境

安装tensorflow

(tensorflow) C:\Users\USER>pip install tensorflow

如果这个失败的话,可以用

(tensorflow) C:\Users\USER>conda install tensorflow

等待…
测试是否安装好,以及查看版本和路径

(tensorflow)C:\Users\USER>python
···
>>>import tensorflow as tf
>>>tf.__version__
>>>tf.__path__

能出结果就是安装好了

3.Jupyter notebook上使用tensorflow

为了让它能在Jupyter上使用

(tensorflow)C:\Users\USER>conda install ipython
···
(tensorflow)C:\Users\USER>conda install jupyter
···

接着会发现Anaconda目录下多出了一个jupyter notebook(tensorflow),进入测试,就可以了

退出tensorflow环境的话用下面命令二选一

(tensorflow) C:\Users\USER>activate base
(tensorflow) C:\Users\USER>deactivate tensorflow

jupyter notebook(tensorflow)和jupyter notebook的包是不共用的,比如在base环境下用pip安装了matplotlib

(base) C:\Users\USER>python -m pip install -U pip setuptools
(base) C:\Users\USER>python -m pip install matplotlib

jupyter notebook可以用,但是jupyter notebook(tensorflow)不能用,需要在tensorflow环境下,用conda安装

(base) C:\Users\USER>activate tensorflow
(tensorflow) C:\Users\USER>conda install matplotlib

效果如下
在这里插入图片描述

参考文献:
https://blog.csdn.net/index20001/article/details/73555182
https://tf.wiki/zh_hans/basic/installation.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值