python_ERROR日常出坑指南(SIMAIR背景下)

1、ModuleNotFoundError: No module named ‘tornado.platform.auto’

----> 3 from tornado.platform.auto import set_close_exec

在https://www.tornadoweb.org/en/stable/releases)

解决:我的tornado版本为6.1,在官网https://www.tornadoweb.org/en/stable/releases了解到6.1版本中的set_close_exec已被移除,所以要对tornado版本降级。根据官网介绍,选择了tornado6.0解决了该问题。

2、AttributeError: ‘str’ object has no attribute ‘decode’

D:\anoconda\envs\simair\lib\site-packages\keras\models.py in load_model(filepath, custom_objects, compile)
    237         if model_config is None:
    238             raise ValueError('No model found in config file.')
--> 239         model_config = json.loads(model_config.decode('utf-8'))
    240         model = model_from_config(model_config, custom_objects=custom_objects)
    241 

AttributeError: 'str' object has no attribute 'decode'

解决:
我的h5py版本为3.2.0,更新为2.10.0

pip install h5py=2.10.0

3、TypeError: unsupported operand type(s) for *: ‘ZMQIOLoop’ and ‘float’

此错误与tornado版本有关,查到应该用tornado==4.5.3,所以pip install tornado==4.5.3
安装之后发现jupyter notebook会闪退,原因是jupyter notebook和tornado版本对应,如下图:
在这里插入图片描述

所以接着重新安装notebook,这里我选择了5.7.8,pip install notebook==5.7.8,安装完之后快捷方式jupyter notebook还是闪退,不过可以在prompt中得对应环境下输入 jupyter notebook来打开,代码可以运行了。

4、UnknownError (see above for traceback): Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.

在命令行显示器下显示如下错误:

Could not create cudnn handle: CUDNN_STATUS_ALLOC_FAILED

##方法一
config = tf.ConfigProto()
      config.gpu_options.allow_growth = True
      session = tf.Session(config=config)
##方法二     
      gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=args.gpu_memory_fraction,allow_growth=True)
      sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options, log_device_placement=False))
      
##方法三:
把config.gpu_options.per_process_gpu_memory_fraction = 1
改成config.gpu_options.per_process_gpu_memory_fraction = 0.4
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值