Ubuntu下配置TensorFlow

本文详细介绍了如何在Ubuntu 16.04 LTS上,按照官方步骤安装TensorFlow r1.4,包括虚拟环境设置和GPU/CPU版本的选择。通过virtualenv安装,并提供了检查pip版本的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Ubuntu下配置TensorFlow是很简单的,但是很多资料比较老,而且不是官方的配置过程,可能让读者不知道具体怎么操作,本文将严格参考官方配置过程,说明TensorFlow r1.0(最新版本是TensorFlow r1.4)的安装步骤。

1.配置环境

虚拟机:VMware Workstation 12 Player

操作系统:Ubuntu 16.0 LTS (ubuntu-16.04.1-desktop-amd64.iso)

2.安装步骤

Installing TensorFlow on Ubuntu

2.1 首先根据你的电脑情况选择安装CPU版还是GPU版

如果你的电脑上有NVIDIA的GPU,那么你就可以安装GPU版本,GPU版本性能比CPU版本高很多。

2.2  virtualenv 虚拟环境安装

We recommend the virtualenv installation

安装命令:

sudo apt-get install python3
sudo apt-get install python3-pip
sudo pip3 install virtualenv

virtualenv env
env/bin/pip install matplotlib
env/bin/pip install numpy
env/bin/pip install scipy
env/bin/pip install scikit-image

$ virtualenv --system-site-packages -p python3 ~/tensorflow # for Python 3.n

$ source ~/tensorflow/bin/activate # bash, sh, ksh, or zsh

Ensure pip ≥8.1 is installed:可以使用env/bin/pip list 命令查看

(tensorflow)$ easy_install -U pip

 (tensorflow)$ pip3 install --upgrade tensorflow     # for Python 3.n

或者

$ pip3 install --upgrade \
  https://storage.googleapis.com/tensorflow/linux/cpu/protobuf-3.1.0-cp35-none-linux_x86_64.whl

3. 测试

$ python
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))



开始你的AI之旅吧,fighting!






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值