在Apple M1 Silicon上,platform.system()和platform.architecture()会返回什么? [英] What does platform.system() and platform.architecture() return on Apple M1 Silicon?
问题描述
我没有可使用的M1 Mac,我读到python支持它.在m1 Mac上这些功能的返回是什么?
I don't have an M1 Mac to work with, I read that python supports it. What's the return of these functions on m1 Macs?
platform.system()
platform.architecture()
谢谢.
推荐答案
在实际的M1 Mac上, platform
模块返回以下值:
On the actual M1 Mac, the platform
module returns the following values:
shuuji3@momo ~ % python3
Python 3.8.2 (default, Dec 21 2020, 15:06:03)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'macOS-11.2.3-arm64-arm-64bit'
>>> platform.system()
'Darwin'
>>> platform.architecture()
('64bit', '')
>>> platform.processor()
'arm'
除此之外,在Rosetta 2(Intel模式)下, platform
模块返回以下内容:
In addition to that, under the Rosetta 2 (Intel mode), the platform
module returns the following:
(Note: For the first command, I'm following the instruction in the article, How to Run Legacy Command Line Apps on Apple Silicon | Walled Garden Farmers.)
shuuji3@momo ~ % env /usr/bin/arch -x86_64 /bin/zsh --login
shuuji3@momo ~ % python3
Python 3.8.2 (default, Dec 21 2020, 15:06:04)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'macOS-11.2.3-x86_64-i386-64bit'
>>> platform.system()
'Darwin'
>>> platform.architecture()
('64bit', '')
>>> platform.processor()
'i386'
我们可以用来区分当前的M1 mac使用哪种模式.
We could use to distinguish under which mode the current M1 mac uses.
这篇关于在Apple M1 Silicon上,platform.system()和platform.architecture()会返回什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!