【Python】ufunc 'subtract' did not contain a loop with signature matching types dtype


轉:https://blog.csdn.net/ztf312/article/details/79419553

報錯:

在linux環境下,通過bash運行python文件,傳遞參數給函數,中途報錯:

ufunc 'subtract' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')

原因:

本地windows調試時候,參數是數字賦值,所以程序正常運行。

在linux環境下,傳遞參數給python文件,傳入是字符串形式,所以無法正常加減運算。

dtype('<U32')是字符串格式。

糾正:

maxv=int(args[3])   # 通過int()函數,將字符串強制轉化為數字。
————————————————
版權聲明:本文為CSDN博主「CS青雀」的原創文章,遵循 CC 4.0 BY 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/ztf312/article/details/79419553


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM