python查看是23位還是64位版本__python

來源:互聯網
上載者:User

需要擷取當前安裝的python是32位還是64位,由於初學,上網找了一些資料也不奏效,後來諮詢前輩才知道的,如下

$ python3.5

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:49:35) 

[GCC 4.2.1 (Apple Inc. build 5577)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

>>> import platform

>>> platform.architecture()

('32bit', '')

>>> 


另外,platform模組還能擷取很多其他資訊,這裡內容轉載s自 python開發_platform_擷取作業系統詳細資料工具

'''
    python中,platform模組給我們提供了很多方法去擷取作業系統的資訊
    如:
        import platform
        platform.platform()   #擷取作業系統名稱及版本號碼,'Windows-7-6.1.7601-SP1'
        platform.version()    #擷取作業系統版本號碼,'6.1.7601'
        platform.architecture()   #擷取作業系統的位元,('32bit', 'WindowsPE')
        platform.machine()    #電腦類型,'x86'
        platform.node()       #電腦的網路名稱,'hongjie-PC'
        platform.processor()  #電腦處理器資訊,'x86 Family 16 Model 6 Stepping 3, AuthenticAMD'
        platform.uname()      #包含上面所有的資訊匯總,uname_result(system='Windows', node='hongjie-PC',
                               release='7', version='6.1.7601', machine='x86', processor='x86 Family
Model 6 Stepping 3, AuthenticAMD')


        還可以獲得電腦中python的一些資訊:
        import platform
        platform.python_build()
        platform.python_compiler()
        platform.python_branch()
        platform.python_implementation()
        platform.python_revision()
        platform.python_version()
        platform.python_version_tuple()
'''


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.