ubuntu16.04 python3安装opencv及tensorflow

网友投稿 306 2022-08-26

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版本:

pythonimport cv2cv2.__version__

命令行输入:

python3

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

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))

会有打印输出,例如,我在TX2上安装成功后,输出为:

ubuntu@tegra-ubuntu:~$ python3Python 3.5.2 (default, Sep 14 2017, 22:51:06) [GCC 5.4.0 20160609] on linuxType "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 zero2017-11-21 06:22:38.821085: I tensorflow/core/common_runtime/gpu/gpu_device.cc:955] Found device 0 with properties: name: NVIDIA Tegra X2major: 6 minor: 2 memoryClockRate (GHz) 1.3005pciBusID 0000:00:00.0Total memory: 7.67GiBFree memory: 5.34GiB2017-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)>>> a=tf.constant(10)>>> b=tf.constant(32)>>> print(sess.run(a+b))42

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

参考文献

[1]. ubuntu16.04 python3安装opencv及tensorflow.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:浅谈企业营销战略创新的对策!(营销战略创新的六大方法)
下一篇:统计学习方法笔记:1.2 线性支持向量机与软间隔最大化
相关文章

 发表评论

暂时没有评论,来抢沙发吧~