How do I get Python 3.11.0 to print out arm4 architecture after installing macOS 64-bit universal2 installer?

I have downloaded and installed Python 3.11.0 from the macOS 64-bit universal2 installer from Python.org on my Apple M4 Silicon Sequoia 15.4.1 but when I run;

import platform print(platform.machine())
in Terminal I get;
x86_64
instead of;
arm64

I cannot reproduce this on my mac.
I have 3.11.6 install not 3.11.0 - not sure why that might make a difference.

This is what I see in detail:

% uname -a
Darwin witcher.internal 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:46 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T8112 arm64

% file `which python3.11`
/usr/local/bin/python3.11: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
/usr/local/bin/python3.11 (for architecture x86_64):	Mach-O 64-bit executable x86_64
/usr/local/bin/python3.11 (for architecture arm64):	Mach-O 64-bit executable arm64

% python3.11
Python 3.11.6 (v3.11.6:8b6ee5ba3b, Oct  2 2023, 11:18:21) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> print(platform.machine())
arm64
>>> ^D

Do you see anything different?

I get this;

M4-MacBook-Pro:~$ uname -a

Darwin M4-MacBook-Pro 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:50 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6041 x86_64

I will download the macOS 64-bit universal2 installer from python.org and try the same again.

I get this now after installing the macOS 64-bit universal2 installer from python.,org for Python 3.11.6;

M4-MacBook-Pro:~$ uname -a

Darwin M4-MacBook-Pro 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:50 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6041 x86_64

I now get this;

M4-MacBook-Pro:~$ file which python3.11

/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]

/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 (for architecture x86_64): Mach-O 64-bit executable x86_64

/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 (for architecture arm64): Mach-O 64-bit executable arm64

M4-MacBook-Pro:~$ python3.11

Python 3.11.6 (v3.11.6:8b6ee5ba3b, Oct 2 2023, 11:18:21) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin

Type “help”, “copyright”, “credits” or “license” for more information.

import platform

print(platform.machine())

x86_64

FYI when posting code and terminal output please use the pre-formatted text option. Its the </> button.

It is possible to change from arm64 to x86_64 using the arch command.

For example I can do this:

% arch -x86_64 python3.11 -c 'import platform;print(platform.machine())'
x86_64

Maybe you set something that is forcing x86_64, but I’m not sure what that would be. What does this report for you?

% arch
arm64

And what does this report?

% arch -arm64 python3.11 -c 'import platform;print(platform.machine())'
arm64

Can you run these commands and see what you get please?

% which python3.11
/usr/local/bin/python3.11

% ls -l `which python3.11`
lrwxr-xr-x  1 root  wheel  73 16 Mar 10:15 /usr/local/bin/python3.11@ -> ../../../Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11

I note that there is a python3.11-intel64 installed on my mac.
If I run that version of python then I see what you see:

% /usr/local/bin/python3.11-intel64 -c 'import platform;print(platform.machine())'
x86_64
M4-MacBook-Pro:~$ arch
i386

I get this;

M4-MacBook-Pro:~$ which python3.11
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11
M4-MacBook-Pro:~$ 
M4-MacBook-Pro:~$ ls -l `which python3.11`
-rwxrwxr-x  1 root  admin  152624  2 Oct  2023 /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11
M4-MacBook-Pro:~$ 

Fixed it. I needed to change shell to /bin/bash/ in Terminal->Settings->General->Shell opens with->Command (complete path):

Thanks

You have something very strange configure on your mac to see this.
Maybe a fix to run an old app you made?

Ok then I expect that you have something in your zsh config that is causing the arch problem.

Apple is strongly in favor of switching it’s user from bash to zsh.
I have not found any issues with using zsh (aside from converting my shell setup scripts from bash to zsh).

The files of interest are ~/.zprofile and ~/.zshrc if you are able to share them I might be able to see why our have the i386 arch.

But happy that switching to bash has you working now.

I was actually using a bash shell before but loaded from a different directory.

I suspect that the bash you where using was built only for intel, hence it was in arch i386. Where as /bin/bash is a universal program.