Keras+tensorflow-gpu环境安装_tensorflow.keras安装-程序员宅基地

技术标签: tensorflow  python  keras  

import tensorflow as tf
import pandas as pd
import numpy as np
import keras
from keras.models import Model
from keras.layers import Input,Flatten,Dense,Conv1D,Conv2D,MaxPool2D,Dropout
from keras.layers import  Embedding, Concatenate
from keras.layers import LSTM
from sklearn.preprocessing import StandardScaler,MinMaxScaler
from matplotlib import pyplot
from math import sqrt
from sklearn.metrics import mean_squared_error

方法1
1.安装python3.6+tensorflow+Keras(gpu)

```python
conda create -n keras-gpu python=3.6
activate keras-gpu
conda install -c anaconda keras-gpu

2.报错
2.1

如果keras的版本和tensorflow的版本不一致,就会报错。

我的tensorflow的版本是1.10.0,而keras的版本是2.6.0

解决方案:
pip uninstall keras
pip install keras==2.2.0

2.2
ModuleNotFoundError: No module named ‘sklearn’

解决方案:
 pip install -U scikit-learn

2.3
ModuleNotFoundError: No module named ‘matplotlib’

解决方案:
pip install matplotlib

2.4
Missing optional dependency ‘xlrd’. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
0

解决方案:
pip install xlrd

2.5
D:\Install\Anaconda3\envs\keras-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:462: 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)])
numpy版本需要升级
Requirement already up-to-date: numpy in d:\install\anaconda3\envs\keras-gpu\lib\site-packages (1.19.5)

pip  install --target=d:\install\anaconda3\envs\keras-gpu\lib\site-packages numpy

方法2
直接利用conda,安装整个GPU环境,相对而言,更快,更简单一些

1、默认源通常下载速度慢,将清华大学的conda软件源添加进去,保证安装的速度。

conda config –-show 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/mro/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/ 
conda config --set show_channel_urls yes 
conda config --show
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

2、安装代码,其中需要查询tensorflow对应的cudatoolkit,cudnn版本,同时cudatoolkit,cudnn版本受限于显卡,需要先查询自己电脑支持的显卡支持的最高版本。


conda create -n keras-gpu python=3.6
activate keras-gpu
conda install cudatoolkit=9.0(xx为自己需要的版本号)
conda install cudnn=7.1
pip install tensorflow-gpu=x.x.x

3、示例(本文安装环境版本)
python3.6+tensorflow-gpu(1.10.0)+keras(2.2.4)+cudatoolkit(9.0)+cudnn(7.1.4)
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

推荐参考博客:

GPU版本Tensorflow+Keras环境安装与配置_keras 2.9.0与tensorflow-gpu版本_繁星之歌的博客-程序员宅基地** https://blog.csdn.net/mangfan1993/article/details/121486811?spm=1001.2101.3001.6650.4&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4-121486811-blog-106436292.235%5Ev38%5Epc_relevant_sort_base2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4-121486811-blog-106436292.235%5Ev38%5Epc_relevant_sort_base2&utm_relevant_index=5

快速简单安装tensorflow与keras的GPU版本_SJTUzhou的博客-程序员宅基地 https://blog.csdn.net/SJTUzhou/article/details/106436292

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_44467482/article/details/131163941

智能推荐

Android-版本说明-安全隐私-1.5~4.1_android 隐私说明大全-程序员宅基地

文章浏览阅读528次。Android 1.5 至 4.1 中的安全增强功能 | Android 开源项目 | Android Open Source Project_android 隐私说明大全

springboot多模块下无法导包的问题_there are circular dependencies between: 1. 'crm_6-程序员宅基地

文章浏览阅读442次。[ERROR] Some problems were encountered while processing the POMs:_there are circular dependencies between: 1. 'crm_6x_core' module, 'busiframe

hping3工具DOS攻击实验_hping3 100%loss-程序员宅基地

文章浏览阅读2.8k次,点赞4次,收藏19次。需要两台机器,一台扮演攻击源,另一做目标源。 攻击源地址:10.0.40.4 被攻击机器地址:10.0.40.246 2 被攻击的机器上安装tcpdump,tcpdump主要是用来抓包的,看看网络数据包是否到达。 $yum install tcpdump -y 3 首先开启tcpdump抓取来自攻击源的数据包,其他数据包应该过排除。 $tcpdump -i eth0 src host 10.0.40.4 -i 是选择哪个网卡 ..._hping3 100%loss

什么是PV、UV和IP-程序员宅基地

文章浏览阅读166次。查看过网站统计的菜鸟经常会PV、UV和IP都是指什么,下面就解释一下。PV是Page View的缩写,翻译成中文叫做“页面访问量”。UV的全称是Unique Visitor,意思是“独立访问者”。IP就不要解释了,就是我们上网的时候使用的IP。看过英文的全称和汉语的解释就很容易理解这三个值了。PV就是指网站的总访问量,刷新一次就是一个PV值。IP就是有一个新IP访问..._pvtwrip

删除win10linux系统,Windows10系统如何重置/注销Linux子系统-程序员宅基地

文章浏览阅读318次。在windows10系统中,如果启用“适用于Linux的Windows子系统(WSL)”安装的某个Linux发行版子系统(例如Ubuntu)出现了问题的话,我们可以注销Linux子系统的发行版,也可以将其重置为默认值,那么Windows10系统如何重置/注销Linux子系统呢?下面给大家分享一下具体的操作步骤。一、重置Linux子系统这个不需要命令行操作,在《Windows设置》中即可直观地进行操..._在window的linux存在之前删除的系统

deepfakes视频的网站_惊了,DeepFakes不仅骗过人,还能骗过人脸识别系统?!-程序员宅基地

文章浏览阅读2.9k次。原标题:惊了,DeepFakes不仅骗过人,还能骗过人脸识别系统?!选自 arXiv作者:Pavel Korshunov、Sebastien Marcel机器之心编辑部今年年初,DeepFakes 技术火爆全网,它可以轻松替换视频中的人脸。网络上各种恶搞视频(其中大量是色情视频)让人分不清真真假假,那么人脸识别系统能够检测出哪些是 DeepFakes 生成的视频吗?这项研究告诉我们不太行……自动视..._deepfake换脸视频

随便推点

Algs4-1.5.3使用加权quick-union算法完成练习1.5.1-程序员宅基地

文章浏览阅读346次。1.5.3使用加权quick-union算法(请见算法1.5)完成练习1.5.1。 转载于:https://www.cnblogs.com/longjin2018/p/..._用quick union完成练习1.5.1

OpenCV_Mat类对象的基本操作、常用操作及相关成员函数介绍_cv::mat.row-程序员宅基地

文章浏览阅读1.2k次。OpenCV_Mat类对象的基本操作、常用操作及相关成员函数介绍_cv::mat.row

UIButton的竖排图片和文本-程序员宅基地

文章浏览阅读51次。UIButton的竖排图片和文本html, body {overflow-x: initial !important;}.CodeMirror { height: auto; }.CodeMirror-scroll { overflow-y: hidden; overflow-x: auto; }.CodeMirror-lines { padding: 4px 0px; }.Code..._ui web 竖向按钮

sniper 3d android,Sniper 3D Shooter by i Games-程序员宅基地

文章浏览阅读55次。Sniper 3D Shooter by i Games 介绍Sniper 3D Shooter by i Games来自应用汇:Sniper 3D Shooter by i Games http://www.appchina.com/app/com.igames.snipershooterterminator?from=spi-descSniper 3D Shooter by i Games ..._sniper shooter games

螺丝头部及其相关知识点_螺丝c头和p头区别-程序员宅基地

文章浏览阅读1.6k次。声明:本文转载于百度文库螺丝规格编定解析举例:4 X 10 PW A . H .C (+)(1) (2) (3) (4) (5) (6) (7)(1)螺丝直径(如上述螺丝规格中的“4”)(2)螺丝长度(如上述螺丝规格中的“10”)(3)螺丝头型(如上述螺丝规格中的“PW”) V: 蘑菇头 C: 圆柱头F(K): 沉头 H: 六角头 HW: 六角..._螺丝c头和p头区别

FPGA实现VGA显示(六)——————多字符显示及基于fpga的“打字机”实现_vga在屏幕不同的位置同时显示多段字符-程序员宅基地

文章浏览阅读5.4k次,点赞7次,收藏58次。前面笔者总结了如何显示单字符,设立通过一个简单的任务来总结如何实现vga多字符显示。实验要求基础:由PC通过UART发送数据在VGA显示。数据可以为字母,数字,汉字(任选10个字),VGA分为左右两个区域,输入字母或者数字时在VGA左边显示,输入汉字时在VGA右边显示。发挥:有删除功能,可通过按键删除显示的数字,字母或者汉字。左边的按键按下字母或者数字删除,右边的按键按下汉字删..._vga在屏幕不同的位置同时显示多段字符

推荐文章

热门文章

相关标签