Which command to use for checking whether python is 64bit or 32bit

后端 未结 4 780
Happy的楠姐
Happy的楠姐 2020-12-14 07:19

I am not able to find any command to check if my python is compiled for 32bit system or 64bit system.

I tried

python

an

4条回答
  •  醉梦人生
    2020-12-14 07:22

    Type in Linux console:

    1. In case when you want check whether an application has 64 bit or 32 bit architecture by using its command for run:
    type -p  | xargs readlink -f | xargs file -b | sed 's/, /\n/g' | sed -n 2p
    
    1. In case when you want check whether an application has 64 bit or 32 bit architecture by using full path to the application:
    file -b  | sed 's/, /\n/g' | sed -n 2p
    

    For example, for Python 3 corresponding commands can be:

    type -p python3 | xargs readlink -f | xargs file -b | sed 's/, /\n/g' | sed -n 2p
    file -b /usr/bin/python3.5 | sed 's/, /\n/g' | sed -n 2p
    

    Possible output:

    x86-64
    

    or

    Intel 80386
    

    or

    ARM
    

    or other.

    If output is "Intel 80386" than the application has 32 bit architecture.

    If output is "x86-64" than the application has 64 bit architecture.

提交回复
热议问题