https://www.cnblogs.com/elroye/p/7864988.html
https://blog.csdn.net/sb19931201/article/details/53648615
注意
1.安装的时候,tensorflow-gpu版本需要指定为1.3.0,一旦版本大于1.4.0,就会与cuda不兼容
pip install tensorflow-gpu==1.3.0
2.安装的时候,出现了长时间黑屏,后来强制关机重启,第二次选择高级安装模式,并仅选择了cuda,而不选择
下面的三项,就安装正常了,后面运行也是正常的
安装结束的测试代码:
import tensorflow as tf
# hello = tf.constant('Hello, TensorFlow!')
# sess = tf.Session()
#Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
#Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
#Runs the op.
print(sess.run(c))
测试结果:
欢迎来到机器学习的新世界!!!
PS:如果在新建的机器学习环境出现了警告,那么在对应的虚拟环境中调整numpy版本
pip uninstall numpy
pip install numpy==1.16.4