简体   繁体   English

即使我使用的是64位,sys.maxint也会返回对应于32位系统的值

[英]sys.maxint returns a value corresponding to a 32 bit system even though I am using a 64 bit

I am not very knowledgeable about system architecture, and have just started learning Python. 我对系统体系结构不是很了解,并且刚刚开始学习Python。

In one of the tutorial videos it was mentioned that running sys.maxint in the interpreter will return the biggest integer that is available to you. 在其中一个教程视频中,提到了在解释器中运行sys.maxint将返回可用的最大整数。

It was also mentioned that 2147483647 is the integer that corresponds to a 32 bit system. 还提到2147483647是对应于32位系统的整数。 That's is the integer that I am being returned when I run sys.maxint. 那是我运行sys.maxint时返回的整数。

I am using Enthought Canopy (64 bit) on a 64 bit OS. 我在64位操作系统上使用Enthought Canopy(64位)。 Windows 8, to be precise. Windows 8,确切地说。

Is there any way I can increase the sys.maxint value to one that corresponds a 64 bit machine? 有什么办法可以将sys.maxint值增加到对应于64位计算机的值?

Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import platform
>>> platform.architecture()
>>> ('64bit', 'WindowsPE')
>>> import sys
>>> sys.maxint
>>> 2147483647
>>> sys.maxint+1
>>> 2147483648L

Seems to be a limitation on Windows. 似乎是Windows的限制。

I would not worry about it, as Python supports bignums and won't overflow. 我不会担心,因为Python支持bignums并且不会溢出。 Although performance will be lower if you exceed sys.maxint . 尽管如果超过sys.maxint性能会降低。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM