• 问题描述

    IDE:pycharm,环境中安装tensorflow-gpu 1.8.0 ,Cuda9 ,cudnn 7,等,运行代码 报错如下
tensorflow.python.framework.errors_impl.InternalError: Failed to create session
  • 解决方案

    在代码中添加gpu的配置代码
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '0' #use GPU with ID=0
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.5 # maximun alloc gpu50% of MEM
config.gpu_options.allow_growth = True #allocate dynamically

来源:CSDN

原文:https://blog.csdn.net/sinat_30372583/article/details/79461468

  • 拓展

    tensorflow-cpu和tensorflow-gpu不能混装,这两个版本不一样,但接口一样。

    gpu的配置还可在run的Configuration中设置,但是不知为啥不起作用。

Tensorflow 报错:tensorflow.python.framework.errors_impl.InternalError: Failed to create session.的更多相关文章

  1. 【python】python安装tensorflow报错:python No matching distribution found for tensorflow==1.12.0

    python安装tensorflow报错:python No matching distribution found for tensorflow==1.12.0 python版本是3.7.2 要安装 ...

  2. tensorflow报错 tensorflow Resource exhausted: OOM when allocating tensor with shape

    在使用tensorflow的object detection时,出现以下报错 tensorflow Resource exhausted: OOM when allocating tensor wit ...

  3. python下pip 安装 pyautogui报错Command "python setup.py egg_info" failed with error code 1 in C:\Users\Administrator\AppData\Local\Temp\pip-install-svhtepho\pygetwindow\

    python装的3.6 64位,使用命令pip install pyautogui 或者pip install -U pyautogui 都失败了 报错如下: Command "python ...

  4. 安装 xadmin 报错: Command "python setup.py egg_info" failed with error code 1 in C:\Users\Python\AppData\Local\Temp\pip-install-1k1byg0p\xadmin\

    报错详情 安装 xadmin 组件的时候报错 不论是命令行还是 pycharm 方式都不行 分析报错 按照报错提示是说 README.rst 文件的编码问题导致. 解决报错 通过 github 下载源 ...

  5. pip安装报错Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e_k8hq6a/pynacl/

    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e_k8hq6a/pyn ...

  6. impdp报错ORA-39083 ORA-02304 Object type TYPE failed to create

    环境Red Hat Enterprise Linux Server release 5.8 (Tikanga)ORACLE Release 11.2.0.3.0 Production 我用expdp, ...

  7. ubuntu下安装pip install mysqlclient 报错 command "python setup.py egg_info" failed with error.....解决方案

    我的环境: ubuntu 1604 版本, 在黑屏终端已经安装了django和virtualenv虚拟环境, 在创建了django的models后开始迁移的操作, 出现错误, 错误代码最后如题目 可以 ...

  8. ubuntu下pig报错ERROR 2999: Unexpected internal error. Failed to create DataStorage的解决

    2019-03-04 00:10:03,998 [main] ERROR org.apache.pig.Main - ERROR 2999: Unexpected internal error. Fa ...

  9. keras:InternalError: Failed to create session

    如题,keras出现以上错误,解决办法: 找到占用gpu的进程: nvidia-smi -q 杀死这些进程即可: xxxxx

随机推荐

  1. Linux环境上部署Flask

    [该文章只涉及个人部署的简单流程,读者可通过其它途径了解详细部署流程] 依个人部署项目可预先安装好需要的环境,这里已提前安装好LNMP环境 1.安装Python环境 安装virtualenv环境 配置 ...

  2. SQL count(1)

    If you are ever unsure what to put inside a COUNT() aggregation, you can do COUNT(1) to count the ro ...

  3. Oracle GoldenGate 18.1发布

    软件下载地址:https://www.oracle.com/technetwork/middleware/goldengate/downloads/index.html 文档下载地址: https:/ ...

  4. tinkpad e450c 进入 BIOS

    电脑开机状态下重启电脑,同时连续单击F1 听到"嘟"的一声继续按F1键即可进入BIOS管理界面. 注意:此时Fn要在锁定状态,即Fn键盘灯亮.[可用Fn+Esc切换Fn锁定和未锁定 ...

  5. 指定Gpu range系列函数

    tensorflow指定GPU训练 import os os.environ[CUDA_VISIABLE_DEVICES] = '0,1'记住DEVICES是复数 range()返回的是range o ...

  6. GHSpro多数据库连接

    GHSpro多数据库连接 文章 1 数据连接 XXX.Application.Web -> XmlConfig -> database.config <connectionStrin ...

  7. 前端如何生成条形码---JsBarcode

    React 生成条形码代码 注:需引入 jsbarcode 插件 import React from 'react'; import JsBarcode from 'jsbarcode'; class ...

  8. vue 3.0的搭建

    1. 删除以前的vue 2.x版本,并下载3.x版本 npm uninstall -g vue-cli / yarn global remove vue-cli npm install -g @vue ...

  9. gzip对字符串的压缩和解压

    package org.jc.plugins.gzip; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStre ...

  10. Transparent PageRoute in Flutter for displaying a (semi-) transparent page

    import 'package:flutter/widgets.dart'; class TransparentRoute extends PageRoute<void> { Transp ...