Travis认为该体系结构是32位的,但Python对此表示反对

问题描述

我正在使用Travis来测试各种版本和体系结构上的Python代码。我正在尝试将32位Linux体系结构纳入其中。 在我的.travis.yml作业的表条目中看到

"i386" written next to the chip graphic

的意义上,下面的arch: x86似乎成功了。但是,我在自省的Python代码中也看到了日志中的以下输出

$ python -c 'import sys,struct,platform;print("{\n%s}"%"".join("    %25r %c %r,\n"%(c,58,eval(c)) for c in """struct.calcsize("P")*8 sys.maxsize platform.machine() platform.architecture()""".split()))'
{
     'struct.calcsize("P")*8' : 64,'sys.maxsize' : 9223372036854775807,'platform.machine()' : 'x86_64','platform.architecture()' : ('64bit','ELF'),}

对于32位版本的Python,struct.calcsize("P")*8应该返回32,而sys.maxsize应该是2147483647。我实际上得到的输出意味着64位版本。而且由于我不相信64位二进制文​​件可以在32位计算机上运行,​​因此似乎有悖常理的事情。我忽略了什么?

# Welcome to .travis.yml

os: linux
arch: x64
language: python
install:
    - python -c 'import sys,eval(c)) for c in """struct.calcsize("P")*8 sys.maxsize platform.machine() platform.architecture()""".split()))'
    - python -m pip install --upgrade pip
    - python -m pip install pytest
    - python -m pip install .

script:
    - python -m pytest -v .
    

matrix:
    include:
        - python: 2.7
        
        # ...
        
        - python: 3.8
      
        - name: "Python 3.8 on 32-bit Linux"
          arch: x86
          python: 3.8

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)