E:\Anaconda3\envs\py39\python.exe D:\LocoAlarmMetro_wh5\alarm\alarm_ground\dcdc\fn_alarm_batteryVolSensor_wave.py
D:\LocoAlarmMetro_wh5\tools\globalVariableFormat.py:20: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
result = {**result, **{train_no: np.zeros(tuple_, dtype=np.object)}} # 使用train_no作为键,创建一个形状为tuple_的全零数组作为值
Traceback (most recent call last):
File "D:\LocoAlarmMetro_wh5\alarm\alarm_ground\dcdc\fn_alarm_batteryVolSensor_wave.py", line 11, in <module>
count_alarm = globalVariableFormat.global_variable_zero((Coach_Num, 3))
File "D:\LocoAlarmMetro_wh5\tools\globalVariableFormat.py", line 20, in global_variable_zero
result = {**result, **{train_no: np.zeros(tuple_, dtype=np.object)}} # 使用train_no作为键,创建一个形状为tuple_的全零数组作为值
File "E:\Anaconda3\envs\py39\lib\site-packages\numpy\__init__.py", line 352, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecationsProcess finished with exit code 1
解决办法:(降低numpy的版本)
pip install numpy==1.20.3
AttributeError: module ‘numpy‘ has no attribute ‘object‘
最新推荐文章于 2025-03-09 22:53:24 发布