FutureWarning: Passing (type, 1) or ‘1type‘ it will be understood as (type, (1,)) / ‘(1,)type‘

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FutureWarning: Passing (type, 1) or ‘1type‘ it will be understood as (type, (1,)) / ‘(1,)type‘相关的知识,希望对你有一定的参考价值。

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'.

目录

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'.

问题:

解决:

完整错误:


启示:
如果对应的错误日志在百度和bing都没有找到满意的结果,快速找google不要犹豫,犹豫就会浪费时间,时间宝贵不用我教你;
如果条件允许,自己搞个梯子,这样就可以使用google查找错误日志,事半功倍;
如果条件不允许,自己去找一些免费的梯子,速度慢一点也能用,毕竟是免费的不要太苛刻;

问题:

pyinstaller --clean --onefile LSTM_prediction.py  

pyinstaller打包执行lstm程序(基于tensorflow 1.14版本编写)

解决:

#许多网上的资料推荐使用如下方法,不过没有解决笔者的问题;

1. pip uninstall numpy 
2. pip install numpy==1.16.4

#

 在jupyter中运行原始程序发现如下日志:

D:\\anaconda\\lib\\site-packages\\tensorflow\\python\\framework\\dtypes.py:525: 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)])
D:\\anaconda\\lib\\site-packages\\tensorboard\\compat\\tensorflow_stub\\dtypes.py:550: 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'.

那么笔者找到对应目录进行修改:

将1改为:(1,)

#原始

_np_qint8 = np.dtype([("qint8", np.int8, 1)])
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
_np_qint32 = np.dtype([("qint32", np.int32, 1)])


# _np_bfloat16 is defined by a module import.

# Custom struct dtype for directly-fed ResourceHandles of supported type(s).
np_resource = np.dtype([("resource", np.ubyte, 1)])

#修改后:

_np_qint8 = np.dtype([("qint8", np.int8, (1,))])
_np_quint8 = np.dtype([("quint8", np.uint8, (1,))])
_np_qint16 = np.dtype([("qint16", np.int16, (1,))])
_np_quint16 = np.dtype([("quint16", np.uint16, (1,))])
_np_qint32 = np.dtype([("qint32", np.int32, (1,))])

# _np_bfloat16 is defined by a module import.

# Custom struct dtype for directly-fed ResourceHandles of supported type(s).
np_resource = np.dtype([("resource", np.ubyte, (1,))])

完整错误:

d; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
C:\\Users\\LIGUAN~1\\AppData\\Local\\Temp\\_MEI178882\\tensorflow\\python\\framework\\dtypes.py:518: 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'.
C:\\Users\\LIGUAN~1\\AppData\\Local\\Temp\\_MEI178882\\tensorflow\\python\\framework\\dtypes.py:519: 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'.
C:\\Users\\LIGUAN~1\\AppData\\Local\\Temp\\_MEI178882\\tensorflow\\python\\framework\\dtypes.py:520: 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'.
C:\\Users\\LIGUAN~1\\AppData\\Local\\Temp\\_MEI178882\\tensorflow\\python\\framework\\dtypes.py:525: 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'.
......
............................

d; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
C:\\Users\\LIGUAN~1\\AppData\\Local\\Temp\\_MEI287642\\tensorflow\\python\\framework\\dtypes.py:525: 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'.
Traceback (most recent call last):
  File "LSTM-Test.py", line 35, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "D:\\anaconda\\envs\\deploy_test\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\\tensorflow\\python\\autograph\\__init__.py", line 37, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "D:\\anaconda\\envs\\deploy_test\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\\tensorflow\\python\\autograph\\core\\converter.py", line 71, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "D:\\anaconda\\envs\\deploy_test\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\\tensorflow\\python\\autograph\\pyct\\cfg.py", line 41, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "D:\\anaconda\\envs\\deploy_test\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\\tensorflow\\python\\autograph\\pyct\\compiler.py", line 32, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "D:\\anaconda\\envs\\deploy_test\\lib\\site-packages\\PyInstaller\\loader\\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\\astor\\__init__.py", line 24, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\\\Users\\\\x~1\\\\AppData\\\\Local\\\\Temp\\\\_MEI253042\\\\astor\\\\VERSION'
[26340] Failed to execute script LSTM

参考:No such file or directory error using pyinstaller and scrapy

参考:"synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'." problem in TensorFlow

以上是关于FutureWarning: Passing (type, 1) or ‘1type‘ it will be understood as (type, (1,)) / ‘(1,)type‘的主要内容,如果未能解决你的问题,请参考以下文章

Python运行tensortflow出现FutureWarning: Passing (type, 1) or '1type' as a synonym of type is dep

FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future

TensorFlow忽略警告信息:FutureWarning

WDL-训练模型

WDL-训练模型

FutureWarning 未与 warnings.simplefilter(action = "error", category=FutureWarning) 一起显示