如何在 arm Mac 上安装 x86 版 python3.10 - V2EX
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
shinsekai

如何在 arm Mac 上安装 x86 版 python3.10

  •  
  •   shinsekai Apr 25, 2024 3872 views
    This topic created in 747 days ago, the information mentioned may be changed or developed.

    有一个 x86 软件需要指定 python 3.10 的位置,现在尝试了几种方法都没有解决:

    1. 官方二进制包,3.9 版本提供 intel 版单独 pkg ,3.10 开始只有 universal 安装包,安装后默认 arm

    2. 使用 Homebrew ,由于使用 arm64 homebrew ,前缀 arch x86 安装软件时会提示 Cannot install under Rosetta 2 in ARM default prefix ,需要将 homebrew 安装到/usr/local ,而不是/opt

    3. 使用 pyenv ,前缀 arch x86 安装时提示 BUILD FAILED ,提示 subprocess.CalledProcessError: Command ......died with <Signals.SIGABRT: 6>.,而 build arm 版 python 则正常。

    请问还有什么装 python 的办法吗

    16 replies    2024-04-26 10:51:59 +08:00
    yulgang
        1
    yulgang  
       Apr 25, 2024
    装个 x86 的虚拟机
    elechi
        2
    elechi  
       Apr 25, 2024
    从别人 x86 电脑上拷贝过来
    dingdangnao
        3
    dingdangnao  
       Apr 25, 2024
    开个服务器吧
    EastLord
        4
    EastLord  
       Apr 25, 2024
    无解,如果开发要用,可以装个 arm linux 虚拟机,然后用 arm 版本的 python3.10
    Davic1
        5
    Davic1  
       Apr 25, 2024
    div class="reply_content">https://github.com/jdx/mise

    可以试试这个,指定版本
    baobao1270
        6
    baobao1270  
       Apr 25, 2024
    Python 应该是架构无关的吧,我猜 x86 软件应该可以调用 aarch 的 Python ,毕竟一般提供外部路径都是走 Pipe / Command Line 的。
    Pyenv build failed ,可能是缺依赖,说不定是系统自带 aarch 的依赖没带 x86 的
    Ricardoo
        7
    Ricardoo  
       Apr 25, 2024
    用 conda , 我试了下,可以安装 x86 版本 python
    conda create -n my_x86_env -y
    conda activate my_x86_env
    conda config --env --set subdir osx-64
    conda install python=3.10
    file $(which python)
    /opt/miniconda3/envs/my_x86_env/bin/python: Mach-O 64-bit executable x86_64
    livenux
        8
    livenux  
       Apr 25, 2024
    @Ricardoo https://www.pypy.org/download.html pypy 也有 x86 的版本下载,我一般有不兼容 arm 的包都是用 pypy 版的 python
    zhangchioulin
        9
    zhangchioulin  
       Apr 25, 2024
    使用 lipo 强制分割出 x86 版本然后自己签名一下?
    atpex
        10
    atpex  
       Apr 25, 2024
    买一台插 86 的 mac
    darcyC
        11
    darcyC  
       Apr 25, 2024
    用 arch 指令可以指定运行架构,这边给几个例子
    arch -arch x86_64 XXXXX
    arch -arch x86_64 python
    arch -arch x86_64 python -m pip XXXXX
    arch -arch x86_64 XXXXXX/bin/pyinstaller XXXXX
    我自己用这个在 arm 架构系统上打包 intel 架构的可执行文件,你具体测试的时候可以在脚本里用下面的代码看当前的架构
    arch = platform.machine()
    具体的话你可以 man arch 看怎么用
    darcyC
        12
    darcyC  
       Apr 25, 2024
    我补充一下上面的内容,为了让所有的流程都可以用,所有的指令前面都要加 arch -arch x86_64 ,包括 pip 等,因为 pip 也会根据当前架构选择下载何种执行文件。arch 指令本质上就是在 universal 包里选择某一种的架构去运行。
    CHEN1016
        13
    CHEN1016  
       Apr 25, 2024 via iPhone
    rosetta2 x86 虚拟机
    huangzhe8263
        14
    huangzhe8263  
       Apr 25, 2024
    如果有 docker 的话可以试试按 x86 的镜像然后安 python
    shinsekai
        15
    shinsekai  
    OP
       Apr 25, 2024
    @darcyC 使用 arch x86_64 安装 homebrew 后再装 python 可以了,暂时没发现双版本 homebrew 共存有什么问题。
    craiiz
        16
    craiiz  
       Apr 26, 2024
    记得终端可以切换到 x86 模式,忘记怎么搞了,你查一下
    About     Help     Advertise     Blog     API     FAQ     Solana     5688 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 60ms UTC 03:33 PVG 11:33 LAX 20:33 JFK 23:33
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86