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.测试

import tensorflow 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
Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow 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.dll
2020-02-02 16:05:23.206508: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: GeForce GTX 1050 major: 6 minor: 1 memoryClockRate(GHz): 1.493
pciBusID: 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: 0
2020-02-02 16:05:23.231882: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-02-02 16:05:23.244758: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: GeForce GTX 1050 major: 6 minor: 1 memoryClockRate(GHz): 1.493
pciBusID: 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: 0
2020-02-02 16:05:24.446747: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-02-02 16:05:24.456384: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0
2020-02-02 16:05:24.460137: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N
2020-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,选择对应的环境

原文地址:https://www.cnblogs.com/lqerio/p/12252526.html

时间: 2024-07-30 12:22:36

anaconda python3.7 安装 tensorflow-gpu 2.0.0 beta1 配置PyCharm的相关文章

CentOS Anaconda(python3.6)安装tensorflow

本来安装tensorflow是一件无比简单的事,但在我的电脑上却装了一个星期.期间遇到各种麻烦事.各种坑,在此记录一下,方便大家.报错包括: undefined symbol: zgelsd_ ImportError: cannot import name 'multiarray' whl is not a supported wheel 1,安装Anaconda 下载地址:https://www.continuum.io/downloads/(我安装的是linux-64-python3.6) 

Win10(64位)下安装Tensorflow GPU

<Python 3.6 + Tensorflow GPU 1.4.0 + CUDA 8.0 + cuDNN 6.0> 没有Pycharm的先安装Pycharm. 1.Python下载地址:https://www.python.org/downloads/release/python-364/ 拉到最底下,选择Windows x86-64 executable installer下载. 注意把Add Python 3.6 to PATH勾选上,再选择Install Now. 2.Tensorfl

windows 10 64bit下安装Tensorflow+Keras+VS2015+CUDA8.0 GPU加速

原文地址:http://www.jianshu.com/p/c245d46d43f0 写在前面的话 2016年11月29日,Google Brain 工程师团队宣布在 TensorFlow 0.12 中加入初步的 Windows 支持.但是目前只支持64位,而且Python版本为3.5版本,需要CUDA 8.0 .之前Tensorflow对windows的支持并不好,导致如果需要使用它,需要转移到Linux平台,或者使用Cygwin什么的,总之挺麻烦,现在好了.麻烦事google帮我们解决了.感

Ubuntu 16.04下安装Tensorflow(GPU)

参考:http://blog.sina.com.cn/s/blog_672f698e0102wavp.html 1.首先安装nvidia显卡驱动: 系统设置->软件更新->附加驱动->选择nvidia最新驱动(361)->应用更改 ?2.下载CUDA8.0 地址https://developer.nvidia.com/cuda-release-candidate-download(需要登陆) 3.安装cuda sudo dpkg -i cuda-repo-ubuntu1604-8-

CentOS下安装python3.6安装tensorflow

1.从anaconda官网(https://www.continuum.io/downloads)上下载Linux版本的安装文件(推荐Python 2.7版本),运行sh完成安装. 安装完Anaconda,也就安装了python3.5等相关工具 2.安装pymysql>>> pip install pymysql 3.安装完成后,打开终端,创建TensorFlow虚拟环境 在Prompt中输入:>>> conda create -n tensorflow python=

Windows 平台安装 TensorFlow GPU

原文引用https://www.dazhuanlan.com/2019/08/26/5d63016142d97/ 国际惯例,看官方文档.官方推荐使用pip安装,安装 TensorFlow 之前需要安装 CUDA 10.1 cuDNN 7.6 Microsoft Visual C++ 2015 Redistributable Update 3 然后执行 pip install tensorflow-gpu 进行安装. 测试一下安装是否成功: import tensorflow as tf 报错,提

Anaconda 安装tensorflow(GPU)

1.安装 如果是安装CPU模式的tensorflow,只要输入一下代码就可以了 pip install tensorflow 下面是gpu模式的安装过程 create a conda environment called tensorflow: # Python 2.7 $ conda create -n tensorflow python=2.7 # Python 3.4 $ conda create -n tensorflow python=3.4 # Python 3.5 $ conda

备忘 ubuntu 18.04 下安装 tensorflow GPU 版本

转自:https://www.cnblogs.com/hutao722/p/9342577.html tensorflow目前已经升级至r1.9版本.在之前的深度学习中,我是在MAC的虚拟机上跑CPU版本的tensorflow程序,当数据量变大后,tensorflow跑的非常慢,在内存不足情况下,又容易造成系统崩溃(虚拟机走的是windows7). 配置信息 为了后续的深度学习,不得已,我在京东买了一部组装厂商提供的主机,是网吧特供机.配置如下: CPU i5 8400 6核 16G内存 GPU

Win10 anaconda python3.6 安装pcap

使用pip或者conda安装包时注意换好源,否则速度很慢.具体设置参见参考链接[4,5]. 使用Linux(物理主机或者虚拟机)安装pypcap包非常容易,不再赘述.Windows10系统上安装的坑很多,这里按照步骤做了具体说明.WinPcap和Win10存在兼容性问题,因此推荐使用Npcap替代WinPcap.Python的pcap模块是libpcap的Python打包版.安装pcap模块需要下载三个组件分别安装. 1)下载 Npcap https://nmap.org/npcap/ Npca