配置python与tensorflow,keras出现问题

  • 1.对于python3.7与python3.6会出现好多不同,模块位置发生变化,出现错误要百度,不能够直接找
    初学者使用MNIST库来练习。一些老代码就会提示找不到:
    ImportError: No module named ‘input_data’
    其实就是模块位置发生了变化。把代码换成下面就好
    #import input_data
    from tensorflow.examples.tutorials.mnist import input_data
    mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)

  • 2.ERROR: astroid 2.2.5 requires typed-ast>=1.3.0; implementation_name == “cpython”
    , which is not installed.
    对于tensorflow进行升级
    pip install --upgrade tensorflow-gpu,
    初学者不建议升级,直接忽略不使用,后期使用出现较大问题

  • 3.tensorlayer模块,使用必须tensorflow为2.0.0,但是在升级之后很多函数名会与以前不同,初学者超级麻烦,建议不使用tensorlayer类似的学习文档,因为目前tensorflow2.0.0的学习资料太少。
    不同对照表格

  • 4.AttributeError: module ‘tensorflow’ has no attribute ‘get_default_graph’
    这是因为keras与tensorflow2.0.0的兼容性出现问题,参考keras和tensorflow-2.0.0-beta1的兼容性问题 - yxdayd的专栏 - CSDN博客

  • 5.Compressed file ended before the end-of-stream marker was reached
    压缩文件在到达结束后结束
    python在下载时,出现上述错误提示,一般这种问题都是因为所下载文件已经存在或下载了部分。若再重新下载,这会出现上述错误。
    解决方式:找到下载的文件目录删除。

  • 6使用keras 运行时报 cannot import name ‘tf_utils’
    keras默认版本高,安装 pip3 install keras==2.2.0 解决

  • 7每次运行tensorflow出现警告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)])
    解决python调用TensorFlow时出现FutureWarning- Passing (type, 1) or ‘1type’ as a synonym of type is deprecate - BigDream123的博客 - CSDN博客

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值