ubuntu16.04 python3安装opencv及tensorflow

重装系统以后,安装深度学习环境还真麻烦,我这里对装tensorflow python3的环境进行整理:

sudo apt-get install python3-pip
sudo pip3 install tensorflow-gpu
sudo pip3 install opencv-python 


我们还可能用到jupyter notebook,安装命令如下:

sudo pip3 install jupyter


python下查看opencv版本:

python
import cv2
cv2.__version__


命令行输入:

python3

然后运行tensorflow安装成功测试代码:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print( sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a+b))
会有打印输出,例如,我在TX2上安装成功后,输出为:

ubuntu@tegra-ubuntu:~$ python3
Python 3.5.2 (default, Sep 14 2017, 22:51:06) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2017-11-21 06:22:38.820962: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:857] ARM64 does not support NUMA - returning NUMA node zero
2017-11-21 06:22:38.821085: I tensorflow/core/common_runtime/gpu/gpu_device.cc:955] Found device 0 with properties: 
name: NVIDIA Tegra X2
major: 6 minor: 2 memoryClockRate (GHz) 1.3005
pciBusID 0000:00:00.0
Total memory: 7.67GiB
Free memory: 5.34GiB
2017-11-21 06:22:38.821134: I tensorflow/core/common_runtime/gpu/gpu_device.cc:976] DMA: 0 
2017-11-21 06:22:38.821159: I tensorflow/core/common_runtime/gpu/gpu_device.cc:986] 0:   Y 
2017-11-21 06:22:38.821195: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1045] Creating TensorFlow device (/gpu:0) -> (device: 0, name: NVIDIA Tegra X2, pci bus id: 0000:00:00.0)
>>> print(tf.Session())
2017-11-21 06:23:00.939320: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1045] Creating TensorFlow device (/gpu:0) -> (device: 0, name: NVIDIA Tegra X2, pci bus id: 0000:00:00.0)
<tensorflow.python.client.session.Session object at 0x7f97f03ef0>
>>> a=tf.constant(10)
>>> b=tf.constant(32)
>>> print(sess.run(a+b))
42

会有你的显卡输出信息,我这里是tx2



参考文献

[1]. ubuntu16.04 python3安装opencv及tensorflow. http://blog.csdn.net/lsh894609937/article/details/72841359

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

农民小飞侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值