Reputation: 83
I am attempting to switch over my default python.exe from 32bit to 64bit. the first time i downloaded and installed python i downloaded the 32bit version. I later found in the project i am currently working on, that I need a 64bit version of python in order for everything to be compatible. I have uninstalled the 32bit version but and installed the 64bit version.
prior to uninstalling the 32bit version i could check my version by typing:
python --version
into the command prompt, however now that the 32bit version is uninstalled and the 64bit version is installed this command no longer works. I have noticed that some files pretaining to the 32bit version are still there (looks like packages that were previously installed using pip)
i have verified the the environment variables (PATH) are properly set for the 64bit python version yet it is still not registering.
when i type
python --version
now it yields:
'python' is not recognized as an internal or external command,
operable program or batch file.
but i am able to run a pythonApp.py with this as its body:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import sys
import struct
print( 8 * struct.calcsize("P"))
print(sys.maxsize)
which yields:
64
9223372036854775807
So i know i am able to run the 64bit python but i am unable to use it from cmd prompt as expected, including when attempting to use the pip.
Upvotes: 3
Views: 15550
Reputation: 2001
For me it was the other way around: I installed the 64bit version first and then the 32bit version but it still defaulted to the 32bit one.
There is a way to fix this and keep both versions, at least for Windows 10:
Both versions should have created two entries each in the PATH
environment variable, with Python 3.9.1 they look like this for me:
C:\Program Files (x86)\Python\Python39-32\
C:\Program Files (x86)\Python\Python39-32\Scripts\
C:\Program Files\Python\Python39\
C:\Program Files\Python\Python39\Scripts\
It seems like whatever is at the top of the list is used first, so simply use the "Move Up" button to move the 64bit above the 32bit version. Afterwards it should default to the 64bit version.
You can still use the 32bit version with:
"C:\Program Files (x86)\Python\Python39-32\python.exe" somecommand
The quotes are required because of the spaces in the path.
Upvotes: 1
Reputation: 83
update -- I found a quick fix for this: this solution will not work if you want to keep both versions and interchange them. but if you only need one, simply uninstall both (Start clean) and then install the version you want to be defaulted first.
simple answer:
make sure you install the bit version you want first.
If you have already installed the 32bit version and want to switch to 64bit version then simply uninstall the 32bit version first then install the 64bit version. Not sure if it was required but i also restarted the pc.
Upvotes: 5