I know an old question. And I know that there are many similar questions. ex. Memory for python.exe on Windows 7 python 32 - does Numpy use only half of the available memory? But none of them seem to really solve the problem.
Using the hint provided here by fooobar.com/questions/294623 / ... , I think I finally fixed this problem.
First you need to install "Microsoft Visual C ++ Express Edition 2008". You can follow the instructions given here: http://blog.victorjabur.com/2011/06/05/compiling-python-2-7-modules-on-windows-32-and-64-using-msvc-2008- express /
The download URL for Microsoft Visual C ++ Express Edition 2008 in the above blog article is dead. But here you can find the Visual C ++ 2008 Express URL Download link Dead? .
(EDIT) I confirmed that the linker that comes with msvc-2010-express also works.
Then start the Visual Studio 2008 Command Prompt from the Start menu → Microsoft Visual C ++ 2008 Express Edition → Visual Studio Tools → Visual Studio 2008 Command Prompt
Then run the following commands:
cd bin editbin.exe /LARGEADDRESSAWARE "C:\Python27\python.exe"
This will set the IMAGE_FILE_LARGE_ADDRESS_AWARE flag in the python executable. With this magic, a 32-bit python will use up to 4 GB (instead of ~ 2 GB on windows).
According to MSDN:
On 64-bit versions of Windows, 32-bit applications marked with the IMAGE_FILE_LARGE_ADDRESS_AWARE flag have 4 GB of address space available.
Now
x = numpy.empty(100000000, dtype=complex128)
works on my 64-bit computer running Windows 7 with 32-bit Python 2.7.
I really hope that the official binary version of python will be sent with this FLAG, which is already installed, since there is no harm in this, but a huge benefit!
As MSDN says:
Setting this flag and then launching the application on a system that does not support 4GT does not affect the application.