numpy 如何修复这个错误?请帮助我

iecba09b  于 11个月前  发布在  其他
关注(0)|答案(1)|浏览(87)

我创建了一个在Android上运行良好的应用程序,但现在我想为iPhone制作它。
问题是我在Xcode模拟器中启动应用程序时出错。
我给予你完整的日志文件

2024-01-04 14:45:51.690055+0100 myapp[72202:753867] Available orientation: KIVY_ORIENTATION=Portrait
2024-01-04 14:45:51.690314+0100 myapp[72202:753867] Initializing python
<string>:1: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
2024-01-04 14:45:52.116725+0100 myapp[72202:753867] Running main.py: 
/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/YourApp/main.pyc
[INFO   ] [Logger      ] Record log in 
/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Data/Application/54E64709-1E9F-4C5C-85AF-9B21DFDFCFF0/Documents/.kivy/logs/kivy_24-01-04_6.txt
[INFO   ] [Kivy        ] v2.2.1
[INFO   ] [Kivy        ] Installed at 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.10.10 (main, Jan  4 2024, 13:55:56) [Clang 13.1.6 (clang-1316.0.21.2.5)]
[INFO   ] [Python      ] Interpreter at 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/myapp"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [Factory     ] 190 symbols loaded
[INFO   ] [Image       ] Providers: img_imageio, img_tex, img_sdl2 (img_dds, img_ffpyplayer, img_pil ignored)
[INFO   ] [Window      ] Provider: sdl2
2024-01-04 14:45:53.796902+0100 myapp[72202:753867] You need UIApplicationSupportsIndirectInputEvents in your Info.plist for mouse support
[INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
[INFO   ] [GL          ] Backend used <sdl2>
[INFO   ] [GL          ] OpenGL version <b'OpenGL ES 2.0 APPLE-19.4.3'>
[INFO   ] [GL          ] OpenGL vendor <b'Apple Inc.'>
[INFO   ] [GL          ] OpenGL renderer <b'Apple Software Renderer'>
[INFO   ] [GL          ] OpenGL parsed version: 2, 0
[INFO   ] [GL          ] Shading version <b'OpenGL ES GLSL ES 1.00'>
[INFO   ] [GL          ] Texture max size <4096>
[INFO   ] [GL          ] Texture max units <8>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [KivyMD      ] 1.1.1, git-Unknown, 2024-01-04 (installed at 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/kivymd/__init__.py")
[INFO   ] [Text        ] Provider: sdl2
Got dlopen error on Foundation: dlopen(/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 0x0001): tried: 
'/Users/new/Library/Developer/Xcode/DerivedData/myapp-deuixmebehiupbgrnnjqvcwsuajz/Build/Products/Debug-iphonesimulator/Foundation.framework/Versions/Current/Foundation' (no such file), 
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' 
(no such file), '/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no such file), 
'/Users/new/Library/Developer/Xcode/DerivedData/myapp-deuixmebehiupbgrnnjqvcwsuajz/Build/Products/Debug-iphonesimulator/Foundation.framework/Versions/C/Foundation' (no such file), 
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation' 
(no such file), '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation' (no such file)
Got fallback dlopen error on Foundation: dlopen(/Groups/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 0x0001): tried: 
'/Users/new/Library/Developer/Xcode/DerivedData/myapp-deuixmebehiupbgrnnjqvcwsuajz/Build/Products/Debug-iphonesimulator/Foundation.framework/Versions/Current/Foundation' (no such file), 
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Groups/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' 
(no such file), '/Groups/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no such file), '/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no 
such file)
[INFO   ] [Camera      ] Provider: avfoundation
OpenCV bindings requires "numpy" package.
Install it via command:
    pip install numpy
 Traceback (most recent call last):
   File 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/numpy/core/__init__.py", 
line 24, in <module>
     from . import multiarray
   File 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/numpy/core/multiarray.py", 
line 10, in <module>
     from . import overrides
   File 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/numpy/core/overrides.py", 
line 8, in <module>
     from numpy.core._multiarray_umath import (
 ImportError: cannot import name '_ArrayFunctionDispatcher' from 'numpy.core._multiarray_umath' (numpy.core._multiarray_umath)
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):
   File 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/numpy/__init__.py", 
line 130, in <module>
     from numpy.__config__ import show as show_config
   File 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/numpy/__config__.py", 
line 4, in <module>
     from numpy.core._multiarray_umath import (
   File 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/numpy/core/__init__.py", 
line 50, in <module>
     raise ImportError(msg)
 ImportError: 
 
 IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
 
 Importing the numpy C-extensions failed. This error can happen for
 many reasons, often due to issues with your setup or how NumPy was
 installed.
 
 We have compiled some common reasons and troubleshooting tips at:
 
     https://numpy.org/devdocs/user/troubleshooting-importerror.html
 
 Please note and check the following:
 
   * The Python version is: Python3.10 from 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/myapp"
   * The NumPy version is: "1.26.3"
 
 and make sure that they are the versions you expect.
 Please carefully study the documentation linked above for further help.
 
 Original error was: cannot import name '_ArrayFunctionDispatcher' from 'numpy.core._multiarray_umath' (numpy.core._multiarray_umath)
 
 
 The above exception was the direct cause of the following exception:
 
 Traceback (most recent call last):
   File "/Users/new/Desktop/toolchain/myapp-ios/YourApp/main.py", line 21, in <module>
   File "/Users/new/Desktop/toolchain/myapp-ios/YourApp/scanner.py", line 15, in <module>
   File 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/cv2/__init__.py", 
line 11, in <module>
     import numpy
   File 
"/Users/new/Library/Developer/CoreSimulator/Devices/52F0DAA0-D1EC-43D8-8E54-C1D3E7811235/data/Containers/Bundle/Application/0845245F-9CE7-42A0-A2C3-F5A1B9508524/myapp.app/lib/python3.10/site-packages/numpy/__init__.py", 
line 135, in <module>
     raise ImportError(msg) from e
 ImportError: Error importing numpy: you should not try to import numpy from
         its source directory; please exit the numpy source tree, and relaunch
         your python interpreter from there.
2024-01-04 14:45:56.390989+0100 myapp[72202:753867] Application quit abnormally!
2024-01-04 14:45:56.462969+0100 myapp[72202:753867] Leaving

字符串
Python版本:3.12.1
Numpy版本:1.26.3
操作系统:MacOS 12.7.2
我使用工具链来安装和构建库
我遵循这个程序:https://kivy.org/doc/stable/guide/packaging-ios.html

9lowa7mx

9lowa7mx1#

Kivy 2.2.1正式支持Python 3.7 - 3.11版本。上次我尝试3.12版本时,我遇到了类似的依赖问题。

相关问题