解决python调用TensorFlow时出现FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecate
2020-01-14 18:03
429 查看
源于正在做的图像处理项目。
首次使用TensorFlow时确实出现了挺多问题,首先遇见的就是:
如图:
查询之后看到了两个不错的解决方式:
第一个(我认为比较恰当的一个):
这种类型的报错一般是源于TensorFLow与某个第三方库版本不对应的原因,也确实是这样,这个是因为Numpy库的版本过高,解决方法就是:
在cmd下输入:pip install numpy==1.16.0,其实只要是1.16.X都可以
如果用的是pycharm的话,修改起来更加方便,直接双击第三方库,勾选specify version,选择任意一个1.16.X版本就可以了。
第二个(我个人觉得有点不妥当):
点击报错的位置,会跳转到dtype.py,将dtype.py中的np.dtype([(“quint8”, np.uint8, 1)])修改为np.dtype([(“quint8”, np.uint8, (1,))])就可以了。
如图:
改为:
这样也是可以的,但是随便改变第三方库的文件我觉得还是不太好,推荐第一种方法。
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version
- Python调用TensorFlow出现“Cannot evaluate tensor using `eval()`: No default session is registered”错误问题的解决
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing解决
- Java出现No enclosing instance of type E is accessible问题解决
- Python json中的Object of type "xxx" is not JSON serializable通用解决办法
- Java中long类型直接赋值出现The literal xxxxxxxxxx of type int is out of range 问题的原因和解决方法
- python2.7web代码用python3.6运行时,浏览器发送请求报错TypeError: Object of type 'bytes' is not JSON serializable的解决办法
- python字符串和变量相加时出现,coercing to unicode need string or buffer nonetype found python 错误的解决
- Python调用SIFT出现的问题:No such file or directory: '*.sift' 解决办法,超好用
- 解决arraycollection赋值修改过程中,出现TypeError: Error #1009: Cannot access a property or method of a null obje
- 解决android出现static void xxx No enclosing instance of type xxx is accessible
- Spring中出现的he hierarchy of the type ** is inconsistent问题解决办法
- python3环境下 tensorflow环境中经常遇到'*' has type str, but expected one of: bytes问题的解决
- 解决Python中出现的TypeError: object of type 'zip' has no len()
- [问题解决] asp.net 中调用 Excel 出现以下提示: Old format or invalid type library.
- Python之Headers value 1 must be of type str or bytes, not <class 'int'>错误的解决
- python3环境下 tensorflow环境中经常遇到'*' has type str, but expected one of: bytes问题的解决
- python出现,coercing to unicode need string or buffer nonetype found python 错误的解决
- The application is not licensed to modify or create schema for this type of data 解决办法
- 解决 C++错误 error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CString' (or there is no