You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kivy iOS Xcode项目启动崩溃,报'module 'subprocess' has no attribute 'popen''错误

Kivy iOS Xcode项目启动崩溃,报'module 'subprocess' has no attribute 'popen''错误

我正在开发一个Kivy应用,已经成功把Kivy项目转换成Xcode项目,但在模拟器上启动时立刻崩溃,错误提示:module 'subprocess' has no attribute 'popen'。

奇怪的是,我自己的Kivy代码里并没有用到subprocess模块(至少我自己没写相关代码),我怀疑是某个依赖模块在调用它。因为代码太长太乱,我就不完整上传了,下面是我所有的导入语句:

import kivy
from kivy.uix.image import Image
from kivy.loader import Loader
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.menu import MDDropdownMenu
from kivy.clock import mainthread, Clock
from kivy.utils import platform
from kivy.core.window import Window
from kivy.config import Config
from kivy.uix.screenmanager import ScreenManager, Screen, SlideTransition
from kivy.storage.jsonstore import JsonStore
from kivy.uix.floatlayout import FloatLayout
from kivymd.uix.card import MDCard
from camera4kivy import Preview
from PIL import Image
from pyzbar.pyzbar import decode

我在另一个帖子里看到有人建议执行以下代码:

import subprocess
print(subprocess.__file__)

执行后输出了:/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py,但我不知道这个输出意味着什么,也不知道该怎么处理。那个帖子提到了“shadowing”(命名遮蔽),但我不太明白这个概念。

如果有人能给我一些解决这个错误的建议,我会非常感激,提前谢谢大家!

以下是Xcode里的完整栈跟踪:

Available orientation: KIVY_ORIENTATION=Portrait
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
Running main.py: /Users/seanaldous/Library/Developer/CoreSimulator/Devices/96414FA1-78EF-4B59-979C-EAFB318C9653/data/Containers/Bundle/Application/04B7EC67-95ED-43C2-9629-D313022AC2FD/sert-clean.app/YourApp/main.pyc
[INFO   ] [Logger      ] Record log in /Users/seanaldous/Library/Developer/CoreSimulator/Devices/96414FA1-78EF-4B59-979C-EAFB318C9653/data/Containers/Data/Application/09B80BAF-7DD7-42CC-B389-6A7D2FF72CC2/Documents/.kivy/logs/kivy_25-05-09_0.txt
[INFO   ] [Kivy        ] v2.3.1
[INFO   ] [Kivy        ] Installed at "/Users/seanaldous/Library/Developer/CoreSimulator/Devices/96414FA1-78EF-4B59-979C-EAFB318C9653/data/Containers/Bundle/Application/04B7EC67-95ED-43C2-9629-D313022AC2FD/sert-clean.app/lib/python3.11/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.11.6 (main, Apr 17 2025, 15:44:50) [Clang 16.0.0 (clang-1600.0.26.6)]
[INFO   ] [Python      ] Interpreter at "/Users/seanaldous/Library/Developer/CoreSimulator/Devices/96414FA1-78EF-4B59-979C-EAFB318C9653/data/Containers/Bundle/Application/04B7EC67-95ED-43C2-9629-D313022AC2FD/sert-clean.app/sert-clean"
[INFO   ] [Logger      ] Purge log fired. Processing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [Factory     ] 195 symbols loaded
[INFO   ] [Image       ] Providers: img_imageio, img_tex, img_sdl2 (img_dds, img_ffpyplayer, img_pil ignored)
[INFO   ] [Loader      ] using a thread pool of 2 workers
[INFO   ] [KivyMD      ] 1.2.0, git-Unknown, 2025-04-03 (installed at "/Users/seanaldous/Library/Developer/CoreSimulator/Devices/96414FA1-78EF-4B59-979C-EAFB318C9653/data/Containers/Bundle/Application/04B7EC67-95ED-43C2-9629-D313022AC2FD/sert-clean.app/lib/python3.11/site-packages/kivymd/__init__.py")
[WARNING] [KivyMD      ] Version 1.2.0 is deprecated and is no longer supported. Use KivyMD version 2.0.0 from the master branch (pip install https://github.com/kivymd/KivyMD/archive/master.zip)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
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-21.0.27'>
[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
Got dlopen error on Foundation: dlopen(/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation, 0x0001): tried: '/Users/seanaldous/Library/Developer/Xcode/DerivedData/sert-clean-guwrahwfihrffocmbkfbpfdpaowh/Build/Products/Debug-iphonesimulator/Foundation.framework/Versions/Current/Foundation' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_22D8075/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.3.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation' (no such file), '/System/Library/Frameworks/Foundation

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 11:13:14