Ubuntu16.0.4配置python2.7和tensorflow

Ubuntu16.0.4配置python2.7和tensorflow

#Ubuntu16.0.4系统自带的有python2.7的版本

#打开终端

#显示python版本信息
python -V

#安装pip
sudo apt-get install python-pip python-dev
sudo apt-get update

#安装tensorflow
pip install tensorflow
sudo python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow==1.12.0 #使用国内的源安装tensorflow,个人比较推荐,下载速度贼快

#验证tensorflow是否安装成功
1.在终端输入命令: python
  2.进入python命令下,测试tensorflow:
    import tensorflow as tf
    sess = tf.Session()
    hello=tf.constant('Hello,Tensorflow!')
    print(sess.run(hello))
  3.回车,若在终端下显示 Hello,Tensorflow! 则表示安装tensorflow成功。
  
 ```
 转载自:https://www.cnblogs.com/wmr95/p/7500960.html

猜你喜欢

转载自blog.csdn.net/better_boy/article/details/106971767