Python3 import tensorflow 出现FutureWarning: Passing (type, 1) or '1type' 问题
Python3 出现 39 or type Tensorflow import
2023-09-14 09:12:12 时间
解决python调用TensorFlow时出现FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecate
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
最近因为要做一个基于深度学习的人脸识别项目,要用到TensorFlow,但是下载完成后后发现import 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_quint8 = np.dtype([("quint8", np.uint8, 1)])的错误,如图
百度了许多,很多说是numpy的版本不对,换了numpy的版本就行了,但是我换了好几个版本都没用,仍然报错,最后发现,可以在pycharm中使用Import tensorflow,然后将点进出现的警告,进入dtype.py,修改对应行的代码,把np.dtype([("quint8", np.uint8, 1)])修改为np.dtype([("quint8", np.uint8, (1,))])就完美解决了,如图
修改为
有 0 个人打赏
私信求帮助
Python3 import tensorflow 出现FutureWarning: Passing (type, 1) or '1type' 问题
numpy降级就可以了,import numpy as np -> print(np.__version__),我的是tf-1.14.0,np-1.17.1,将np改为pip install numpy==1.16.0即可
相关文章
- 【Python3网络爬虫开发实战】1.7.3-Appium的安装
- python3之文件操作
- Python3中遇到UnicodeEncodeError: 'ascii' codec can't encode characters in ordinal not in range(128)
- ch1:python3 查看版本号、安装目录和工作空间目录
- Python3 新增加的数据类型:枚举 enum
- Centos7安装Python3并更改默认版本为python3(编译安装)
- Python3 拼接符+和join效率对比测试
- Python3序列解包
- 【Python3网络爬虫开发实战】 1.2.2-Selenium的安装
- 【LeetCode 中等 字符串 python3】524 通过删除字母匹配到字典里最长单词
- 【LeetCode 简单 字符串 python3】557 反转字符串中的单词 III
- 自学Python3个月成功就业,摸爬滚打工作5年,现在月薪40K
- python3的eval和exec的区别与联系
- Python3 selenium 3 自动化测试(三)