本文介紹了numpy 數組 dtype 在 Windows 10 64 位機器中默認為 int32的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我在筆記本電腦上安裝了 Anaconda 3 64 位,并在 Spyder 中編寫了以下代碼:
I have installed Anaconda 3 64 bit on my laptop and written the following code in Spyder:
import numpy.distutils.system_info as sysinfo
import numpy as np
import platform
sysinfo.platform_bits
platform.architecture()
my_array = np.array([0,1,2,3])
my_array.dtype
這些命令的輸出顯示如下:
Output of these commands show the following:
sysinfo.platform_bits
Out[31]: 64
platform.architecture()
Out[32]: ('64bit', 'WindowsPE')
my_array = np.array([0,1,2,3])
my_array.dtype
Out[33]: dtype('int32')
我的問題是,即使我的系統是 64 位的,為什么默認數組類型是 int32 而不是 int64?
My question is that even though my system is 64bit, why by default the array type is int32 instead of int64?
感謝任何幫助.
推薦答案
默認整數類型np.int_
是C long:
Default integer type np.int_
is C long:
http://docs.scipy.org/doc/numpy-1.10.1/user/basics.types.html
但是 C long 在 win64 中是 int32.
But C long is int32 in win64.
https://msdn.microsoft.com/en-us/library/9c3yd98k.aspx一個>
這有點奇怪.
這篇關于numpy 數組 dtype 在 Windows 10 64 位機器中默認為 int32的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!