pip3安装tensorflow
来源:互联网 发布:李晨璐 数据 编辑:程序博客网 时间:2024/04/30 05:58
网上教程很多,当然官方也有,不过大部分地方都是用Python2来安装的,
这里是我自己总结的,尽量使用高版本的环境来安装
操作系统:Xubuntu17.04 64位
Python版本使用Python3.5
这里使用 pip3 安装,下次再介绍源码编译安装,对于初次接触的人来讲,还是pip3安装比较方便
1. 安装pip3,
sudo apt install python3-pip
2. 安装TensorFlow
sudo pip3 install tensorflow
等待片刻,TensorFlow安装完成
验证安装,执行命令如下:
$ python3Python 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import tensorflow as tf>>> hello = tf.constant('Hello, TensorFlow!')>>> sess = tf.Session()2017-08-28 13:02:47.410873: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.2017-08-28 13:02:47.410971: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.2017-08-28 13:02:47.410990: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.>>> print(sess.run(hello))b'Hello, TensorFlow!'>>> a = tf.constant(10)>>> b = tf.constant(32)>>> print(sess.run(a+b))42>>> quit()
中间有打印一些告警信息,如果是使用源码编译方式安装的话,应该不会出现,而我们这里是使用pip3来安装的,所以对这些指令不支持
当然也可以创建一个文件hello_tensor.py,输入内容如下:
import tensorflow as tfhello = tf.constant('Hello, TensorFlow!')sess = tf.Session()print(sess.run(hello))a = tf.constant(10)b = tf.constant(32)print(sess.run(a+b))
然后执行命令
python3 hello_tensor.py
也会出现相同的打印结果
由于本人对Python语言也不熟悉,之前都是使用C语言的,所以如果有什么问题,请看到的诸位批评指正
阅读全文
0 0
- pip3安装tensorflow
- [TensorFlow] ubuntu16.04 pip3安装 TensorFlow
- 已安装python3,安装pip3 ,再安装tensorflow(for mac)
- Fedora25安装pip3
- 安装settools、pip3
- CentOS 安装 pip3
- 安装pip2、pip3
- windows10安装python3.5 pip3
- Python3、setuptools、Pip3安装详解
- CentOS 安装Python3 及 Pip3
- Centos7:3分钟安装pip3
- centos7 下安装pip pip3
- python3安装与pip3使用
- Mac 安装 python3 , pip3 , pygame
- centos7 python3.X 安装 pip3安装
- [TensorFlow] Ubuntu16.04 更新最新的pip3 正确方式
- centos7 安装 python3 pip3不能使用问题
- [bigdata-64] centos 6.8 安装 pip3 python3
- ArrayList 删除指定值
- c++为什么没有finaly,如何保证exception-safe?
- 解决:FreeChart图形中文乱码问题
- Spark RDD API
- c++调用java
- pip3安装tensorflow
- 微信小程序设计
- Dbunit
- poj 2739
- HDU1274 展开字符串
- 深入理解Java对象的创建过程:类的初始化与实例化
- MySQL约束及相关操作
- CCF 火车购票(Java)
- LintCode:M-逆波兰表达式求值