python3.7 tensorflow gpu安装_anaconda python3.7 安装 tensorflow-gpu 2.0.0 beta1 配置PyCharm

参考tensorflow 公众号《tensorflow2.0 安装指南》

https://mp.weixin.qq.com/s/7rNXFEC5HYe91RJ0-9CKdQ

# 1. NVIDIA驱动程序安装

安装对应的CUDA 和 cudnn  (在tensorflow 公众号《tensorflow2.0 安装指南》得知 2.0-beta1对应CUDA 10.0 cudnn 7.6.0)

之前安装tensorflow-gpu 1.14的时候安装了CUDA 10.0 和CUDNN 7.6.1

# 2. anaconda 环境创建与安装

conda create --name tf2.0 python=3.7

activate tf2.0

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow-gpu==2.0.0-beta1    ///清华源

# 3.测试

importtensorflow as tf

A= tf.constant([[1, 2], [3, 4]])

B= tf.constant([[5, 6], [7, 8]])

C=tf.matmul(A, B)print(C)

输出如下,安装成功

tf.Tensor(

[[19 22]

[43 50]], shape=(2, 2), dtype=int32)

中间输出了一些提示信息

(tf2.0) C:\Users\lenovo>python

Python3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64bit (AMD64)] :: Anaconda, Inc. on win32

Type"help", "copyright", "credits" or "license" formore information.>>> importtensorflow as tf

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_qint8= np.dtype([("qint8", np.int8, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_quint8= np.dtype([("quint8", np.uint8, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_qint16= np.dtype([("qint16", np.int16, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_quint16= np.dtype([("quint16", np.uint16, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_qint32= np.dtype([("qint32", np.int32, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

np_resource= np.dtype([("resource", np.ubyte, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_qint8= np.dtype([("qint8", np.int8, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_quint8= np.dtype([("quint8", np.uint8, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_qint16= np.dtype([("qint16", np.int16, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_quint16= np.dtype([("quint16", np.uint16, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_qint32= np.dtype([("qint32", np.int32, 1)])

F:\Anaconda\envs\tf2.0\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

np_resource= np.dtype([("resource", np.ubyte, 1)])>>> A=tf.constant([[1,2],[3,4]])2020-02-02 16:05:20.597693: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll2020-02-02 16:05:23.206508: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:

name: GeForce GTX1050 major: 6 minor: 1 memoryClockRate(GHz): 1.493pciBusID:0000:01:00.0

2020-02-02 16:05:23.215470: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.2020-02-02 16:05:23.224739: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 02020-02-02 16:05:23.231882: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was notcompiled to use: AVX22020-02-02 16:05:23.244758: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:

name: GeForce GTX1050 major: 6 minor: 1 memoryClockRate(GHz): 1.493pciBusID:0000:01:00.0

2020-02-02 16:05:23.259879: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.2020-02-02 16:05:23.269339: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 02020-02-02 16:05:24.446747: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1edge matrix:2020-02-02 16:05:24.456384: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187] 02020-02-02 16:05:24.460137: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0: N2020-02-02 16:05:24.466395: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1347 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1)>>> B=tf.constant([[1,2],[3,4]])>>> B=tf.constant([[5,6],[7,8]])>>> C=tf.matmul(A,B)>>> print(C)

tf.Tensor(

[[19 22]

[43 50]], shape=(2, 2), dtype=int32)>>>

# 4. IDE设置 PyCharm

点击蓝圈处,add,选择对应的环境

ebd43a251d3083af9c789b2242f0ef4b.png

3ea7f690d78fd27ecfadb75699c697fd.png

# 5 偶尔遇到的问题  no module named tensorflow

有一次   import  tensorflow 时报没有这个module,试了好几次也不行,重启终端好了,不知道是什么原因(汗)

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值