无法使用 Kivy 工具链为 iOS 编译第三方包

Posted

技术标签:

【中文标题】无法使用 Kivy 工具链为 iOS 编译第三方包【英文标题】:Unable to compile third-party package for iOS using Kivy toolchain 【发布时间】:2016-01-19 19:42:49 【问题描述】:

我正在做一个小型测试项目,想将Robot Remoteserver 添加到 ios 设备上,但无法获得工具链来成功构建包。这是我尝试构建此软件包时遇到的错误:

copying build/lib/robotremoteserver.py -> /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages
byte-compiling /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver.py to robotremoteserver.pyc
writing byte-compilation script '/tmp/tmpM9XgVf.py'
/Users/usman/kivy/kivy-ios/dist/hostpython/bin/python -OO /tmp/tmpM9XgVf.py
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
removing /tmp/tmpM9XgVf.py
running install_egg_info
Removing /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver-devel-py2.7.egg-info
Writing /Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver-devel-py2.7.egg-info
Traceback (most recent call last):
  File "./toolchain.py", line 1224, in <module>
    ToolchainCL()
  File "./toolchain.py", line 1040, in __init__
getattr(self, args.command)()
  File "./toolchain.py", line 1064, in build
build_recipes(args.recipe, ctx)
  File "./toolchain.py", line 933, in build_recipes
recipe.execute()
  File "/Users/usman/kivy/kivy-ios/toolchain.py", line 556, in execute
self.build_all()
  File "/Users/usman/kivy/kivy-ios/toolchain.py", line 56, in _cache_execution
f(self, *args, **kwargs)
  File "/Users/usman/kivy/kivy-ios/toolchain.py", line 668, in build_all
self.install()
  File "/Users/usman/kivy/kivy-ios/toolchain.py", line 56, in _cache_execution
f(self, *args, **kwargs)
  File "/Users/usman/kivy/kivy-ios/toolchain.py", line 794, in install
self.install_python_package()
  File "/Users/usman/kivy/kivy-ios/toolchain.py", line 835, in install_python_package
dest_dir)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 171, in copytree
names = os.listdir(src)
OSError: [Errno 2] No such file or directory: '/Users/usman/kivy/kivy-ios/build/robotremoteserver/i386/PythonRemoteServer-master/iosbuild/lib/python2.7/site-packages/robotremoteserver'

对于找不到平台相关库这一行,我确实设置了 PYTHONPATH,但仍然出现此错误。

由于构建脚本没有可遵循的模板,我查看了 kivy 附带的包的构建文件并创建了一个包含以下内容的文件

from toolchain import PythonRecipe

class RobotRemoteServer(PythonRecipe):
    version = "master"
    url = "https://github.com/robotframework/PythonRemoteServer/archive/version.zip"
    depends = ["python"]


recipe = RobotRemoteServer()

我已确保 Kivy 及其所依赖的软件包都已正确安装。我也搜索了网络,但无法完全弄清楚问题所在。我正在使用 Xcode 6.4 和最新的 kivy 从 git 拉取。我已经坚持了几天,感谢任何帮助或指导。

【问题讨论】:

【参考方案1】:

Kivy 食谱遵循与python-for-android 相同的格式。 Here 你有相关的文档。

【讨论】:

以上是关于无法使用 Kivy 工具链为 iOS 编译第三方包的主要内容,如果未能解决你的问题,请参考以下文章

为 Kivy-ios 编译自定义模块

如何在 Kivy-iOS 上修改屏幕分辨率

python3:Kivy 编译 iOS 错误。没有蟒蛇食谱

麻烦交叉编译 Python 2 Xcode:kivy-ios 分发抛出错误

Python程序打包成Android包

Kivy,Python:我无法减小 PyInstaller 生成的包的大小