TensorFlow的环境配置与安装方法
作者:Blessy_Zhu 时间:2022-10-29 12:23:19
一、 简介
TensorFlow是一个基于数据流编程(dataflow programming)的符号数学系统,被广泛应用于各类机器学习(machine learning)算法的编程实现,其前身是谷歌的神经网络算法库DistBelief。
Tensorflow拥有多层级结构,可部署于各类服务器、PC终端和网页并支持GPU和TPU高性能数值计算,被广泛应用于谷歌内部的产品开发和各领域的科学研究 。
TensorFlow由谷歌人工智能团队谷歌大脑(Google Brain)开发和维护,拥有包括TensorFlow Hub、TensorFlow Lite、TensorFlow Research Cloud在内的多个项目以及各类应用程序接口(Application Programming Interface, API) [2] 。自2015年11月9日起,TensorFlow依据阿帕奇授权协议(Apache 2.0 open source license)开放源代码 。
TensorFlow即可以支持CPU,也可以支持CPU+GPU。前者的环境需求简单,后者需要额外的支持。
TensorFlow是基于VC++2015开发的,所以需要下载安装VisualC++ Redistributable for Visual Studio 2015 来获取MSVCP140.DLL的支持。
下载并安装anaconda
下载并安装Python编译器,以3.7X为例。
如果要安装GPU版本(有N卡,即NVIDIA显卡),需要以下额外环境:
0)有支持CUDA计算能力3.0或更高版本的NVIDIAGPU卡。
1)下载安装CUDA Toolkit 8.0,并确保其路径添加到PATH环境变量里;
2)下载安装cuDNN v6或v6.1,并确保其路径添加到PATH环境变量里;
3)CUDA8.0相关的NVIDIA驱动。
二、安装
1.检查Anaconda是否成功安装:conda --version
2.检测目前安装了哪些环境:conda info --envs
3.检查目前有哪些版本的python可以安装:conda search --full-name python
4.安装不同版本的python:conda create --name tensorflow python=3.7
5.按照提示,激活之:activate tensorflow
6.确保名叫tensorflow的环境已经被成功添加:conda info --envs
7.检查新环境中的python版本:python --version
8.退出当前环境:deactivate
三、TensorFlow安装
pip install tensorflow
验证是否安装成功:有三种方式
(1)直接在cmd中依次输入python
然后键入
import tensorflow as tf
hello = tf.constant(‘Hello tensorfolw')
sess = tf.Session()
print(sess.run(hello))
结果:b'Hello tensorfolw',则安装成功。
(1)在anaconda中的applications on 中选择TensorFlow,然后launch Spyder
进入Spyder之后,输入上面的代码,然后点击run.如在console中出现如下输出b'Hello tensorfolw',则安装成功。
(3)在pycharm中输入一下内容:
import tensorflow as tf
hello = tf.constant('Hello tensorfolw')
sess = tf.Session()
print(sess.run(hello))
如无误也会出现一下内容
来源:https://blog.csdn.net/weixin_42555080/article/details/100704078
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
js实现简易垂直滚动条
![](https://img.aspxhome.com/file/2023/4/123444_0s.png)
PHP convert_cyr_string()函数讲解
![](https://img.aspxhome.com/file/2023/4/55394_0s.png)
导航设计的流行趋势
![](https://img.aspxhome.com/file/UploadPic/200712/25/2007122512955218s.jpg)
Python机器学习入门(三)之Python数据准备
javascript增加干扰数据实现简单加密效果
Python绘制动态的521玫瑰花
![](https://img.aspxhome.com/file/2023/2/108162_0s.png)
Anaconda+pycharm安装及环境配置全过程
![](https://img.aspxhome.com/file/2023/3/95703_0s.png)
Python获取时光网电影数据的实例代码
![](https://img.aspxhome.com/file/2023/9/112579_0s.png)
Python深度学习之使用Pytorch搭建ShuffleNetv2
![](https://img.aspxhome.com/file/2023/8/105458_0s.png)
详解vue中的computed的this指向问题
![](https://img.aspxhome.com/file/2023/7/133157_0s.png)
Python面向对象程序设计OOP入门教程【类,实例,继承,重载等】
js获取指定字符前/后的字符串简单实例
javascript contains和compareDocumentPosition 方法来确定是否HTML节点间的关系
关于MySQL中隐藏空间的问题
详解SQL Server中数据库快照工作原理
Python使用循环神经网络解决文本分类问题的方法详解
![](https://img.aspxhome.com/file/2023/4/80804_0s.png)
OpenCV图像缩放resize各种插值方式的比较实现
![](https://img.aspxhome.com/file/2023/0/92070_0s.png)
mysql5.7.19 安装配置方法图文教程(win10)
![](https://img.aspxhome.com/file/2023/8/79018_0s.png)