如何在Python 3.11、iPadOS 17.6中获取`bitarray`模块?

问题描述 投票:0回答:1

我想使用

bitarray
模块。我输入了命令
$ pip3 install bitarray
。安装成功了,但是导入的时候报错了

代码:

import bitarray

错误信息:

Traceback (most recent call last):
  File "/var/mobile/Containers/Data/Application/70D7D19F-D760-465F-9349-B9B457DDB1E0/Documents/TestCode.py", line 1, in <module>
    import bitarray
  File "/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/__init__.py", line 14, in <module>
    from bitarray._bitarray import (bitarray, decodetree, _sysinfo,
ImportError: dlopen(/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so, 0x0002): tried: '/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so' (mach-o file (/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so), but incompatible platform (have 'macOS', need 'iOS')), '/private/preboot/Cryptexes/OS/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so' (no such file), '/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so' (mach-o file (/private/var/mobile/Containers/Shared/AppGroup/CA6D7B01-BD6D-4954-A540-18C24905E5B4/home/lib/python3.11/site-packages/bitarray/_bitarray.cpython-311-darwin.so), but incompatible platform (have 'macOS', need 'iOS'))

我以为问题是我安装了

bitarray
3.0.0版本,它不支持我的iPadOS 17.6操作系统。我尝试像这样安装2.7.3版本:
$ pip3 install bitarray==2.7.3
。 Bitarray 2.7.3安装成功(还说3.0.0版本卸载成功),但是当我尝试的时候却出现了同样的错误信息
import bitarray
.

我正在使用Python 3.11,我该怎么办?

python installation version bitarray
1个回答
0
投票

PyPI 包通常无法直接在移动设备上运行,因为移动操作系统(iOS 和 Android)本身不支持 Python 执行。

但是您可以使用 JunoPythonista,它为 iPad 和 iPhone 提供了 Python 开发环境。

© www.soinside.com 2019 - 2024. All rights reserved.