python遇到的错误

在运行understand_facenet时,由于TensorFlow版本的问题遇到以下错误:
1、AttributeError: module ‘tensorflow’ has no attribute ‘GPUOptions’
原本:gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_memory_fraction)
改为:gpu_options = tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=gpu_memory_fraction)
2、AttributeError: module ‘tensorflow’ has no attribute ‘Session’. Did you mean: ‘version’?
原本:sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options, log_device_placement=False))
改成:sess = tf.compat.v1.Session(config=tf.ConfigProto(gpu_options=gpu_options, log_device_placement=False))
3、AttributeError: module ‘tensorflow’ has no attribute ‘ConfigProto’
原本:sess = tf.compat.v1.Session(config=tf.ConfigProto(gpu_options=gpu_options, log_device_placement=False))
改为:sess = tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(gpu_options=gpu_options, log_device_placement=False))
还有其他类似的,都加上compat.v1,不过挺多的可以重新安装一下版本。
4、ValueError: Object arrays cannot be loaded when allow_pickle=False
原本:allow_pickle=allow_pickle
改成:allow_pickle=True
5、AttributeError: ‘int’ object has no attribute ‘value’
原本:feed_in, dim = (inp, input_shape[-1].value)
改为:feed_in, dim = (inp, input_shape[-1])
6、AttributeError: scipy.misc is deprecated and has no attribute imread.
解决:要不降级,要不改用
import imageio
content_image = imageio.imread
7、SyntaxError: from __ future__ imports must occur at the beginning of the file
__ future__ 必须在导入库的开头

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值