platform.system() 和 platform.architecture() 在 Apple M1 芯片上返回什么? [英] What does platform.system() and platform.architecture() return on Apple M1 Silicon?

查看:58
本文介绍了platform.system() 和 platform.architecture() 在 Apple M1 芯片上返回什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有可以使用的 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:

(注意:对于第一个命令,我按照文章中的说明进行操作,如何在 Apple Silicon | Walled Garden Farmers 上运行传统命令行应用程序.)

(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.

这篇关于platform.system() 和 platform.architecture() 在 Apple M1 芯片上返回什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆