alibaba / tidevice

tidevice can be used to communicate with iPhone device
MIT License
2.41k stars 454 forks source link

m1 安装 tidevice 成功,执行 tidevice version 报错 #103

Open jiaxw32 opened 3 years ago

jiaxw32 commented 3 years ago

m1 上安装各种问题啊,希望可以优化解决下

执行安装脚本 pip3 install -U "tidevice[openssl]"

Pillow 报错,解决方案参考: 苹果Macbook Pro 13 M1芯片安装Pillow的正确姿势

手动安装 Pillow,之后再执行安装脚本,安装成功,最终提示成功 如下:

Successfully installed cached-property-1.5.2 colored-1.4.2 logzero-1.7.0 pyOpenSSL-20.0.1 tidevice-0.4.8

执行 tidevice version 报错:

Traceback (most recent call last):
  File "/Users/admin/Library/Python/3.8/bin/tidevice", line 5, in <module>
    from tidevice.__main__ import main
  File "/Users/admin/Library/Python/3.8/lib/python/site-packages/tidevice/__init__.py", line 7, in <module>
    from ._device import BaseDevice as Device
  File "/Users/admin/Library/Python/3.8/lib/python/site-packages/tidevice/_device.py", line 30, in <module>
    from PIL import Image
  File "/Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: dlopen(/Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so, 2): no suitable image found.  Did find:
    /Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so: mach-o, but wrong architecture
    /Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so: mach-o, but wrong architecture

查看 _imaging.cpython-38-darwin.so 架构

file /Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so

输出结果

/Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so: Mach-O 64-bit bundle x86_64
codeskyblue commented 3 years ago

我的的是M1 python 3.9 安装完之后,看样子没什么问题

codeskyblue commented 3 years ago

See this issue https://github.com/python-pillow/Pillow/issues/5093 this may help you.

jiaxw32 commented 3 years ago

使用 file 命令查看 Pillow 架构,如果安装的是 x86_64 架构的 Pillow

➜ $ file /Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so
/Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so: Mach-O 64-bit bundle x86_64

这样执行

$ arch -x86_64 tidevice version

arm64 架构的 Pillow

➜ $ file  /Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so
/Users/admin/Library/Python/3.8/lib/python/site-packages/PIL/_imaging.cpython-38-darwin.so: Mach-O 64-bit bundle arm64

直接执行即可:

➜ $ tidevice -v
0.4.8

另外官网 没有找到 arm 架构的安装包,我是从这里下载的: