I wanted to use the bitarray module. I typed the command $ pip3 install bitarray. It was successfully installed, but it reported an error when I tried to import it.
Code:
import bitarray
Error message:
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'))
I thought the problem is that I installed the bitarray 3.0.0 version, which does not support my iPadOS 17.6 operating system. I tried to install the 2.7.3 version like this:$ pip3 install bitarray==2.7.3. Bitarray 2.7.3 was successfully installed (it also said the 3.0.0 version was successfully uninstalled), but the same error message appeared when I tried to import bitarray.
I’m using Python 3.11, what should I do?
pip3 install bitarray==2.7.3to install a specific version of a library. If you use space pip will interpret 2.7.3 as a second library to install, use==instead