Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installed Python with 32 bit install, appears as 64 bit

Tags:

python

I need to run the 32 bit version of Python. I thought that was what I had running on my machine, as that is the installer I downloaded and when I rerun the installer is refers to the currently installed version of Python as "Python 3.5 32-Bit".

However when I run platform.architecture() it states that I am running 64 bit. I know this isn't always reliable so I also ran sys.maxsize and it returns 9223372036854775807, so I am definitely running the 64 bit install.

I need to run the 32 bit version of Python to interface with the 32 bit Java using pywinauto. I'm running Windows 7 Enterprise, 64-bit.

like image 308
Ian Pringle Avatar asked Mar 11 '23 14:03

Ian Pringle


2 Answers

This sounds like you might have multiple instances of Python installed on your machine. Verify that you're calling the correct one by calling it explicitly from its full path, and noting if its still saying 64-bit or 32-bit.

Moving forward, using a virtualenv might simplify any confusion of which python installation, and which installed packages, are being used.

like image 56
brettb Avatar answered Mar 24 '23 04:03

brettb


You can determine if your Python is truly 64bit by running this code and looking at Task Manager in Windows (or its equivalent in Linux) and seeing what is the maximum allocated memory for the program. If it is 2GB (it could be 3GB for some cases I am not sure) then it is Python 32bit. Otherwise 64bit. On my computer the program executed till 9GB and then almost hanged the computer.

a=[]
while(True):
    a.append([1234]*10000000)
like image 39
keiv.fly Avatar answered Mar 24 '23 04:03

keiv.fly