PyInstaller中的Kivy Garden-尝试跟踪导入时卡住了 [英] Kivy Garden in PyInstaller - stuck trying to trace import

查看:356
本文介绍了PyInstaller中的Kivy Garden-尝试跟踪导入时卡住了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个基于Kivy的Python项目.通过导入,它使用了来自Kivy Garden的NavigationDrawer组件:

I have a Kivy-based Python project that I'm trying to build. It uses the NavigationDrawer component from Kivy Garden, through an import:

从kivy.garden.navigationdrawer导入NavigationDrawer

from kivy.garden.navigationdrawer import NavigationDrawer

我有一个PyInstaller规范文件,该文件可构建可分发版本.此版本在我的计算机上运行良好,但不幸的是,在其他计算机上却不行.使用-v开关以'dist'版本运行解释器时,似乎在我的计算机上运行可分发文件时,navigationdrawer组件实际上并非来自我的build文件夹.所有其他导入都显示类似以下内容:

I have a PyInstaller spec file for it which builds a distributable version. This version works well on my machine, but unfortunately not on other machines. Running the interpreter in the 'dist' version with the -v switch, it appears that when I run the distributable on my machine, the navigationdrawer component is not actually coming from inside my build folder. All the other imports show something like:

import kivy.graphics.gl_instructions#从C:\ Users \ me \ myapp \ dist \ RACECA〜1 \ kivy.graphics.gl_instructions.pyd动态加载

import kivy.graphics.gl_instructions # dynamically loaded from C:\Users\me\myapp\dist\RACECA~1\kivy.graphics.gl_instructions.pyd

但是导航抽屉导入显示:

But the navigationdrawer import says:

导入kivy.garden.navigationdrawer

import kivy.garden.navigationdrawer

"目录C:\ Users \ me \ .kivy \ garden \ garden.navigationdrawer C:\ Users \ me \ .kivy \ garden \ garden.navigationdrawer \ __ init__.py匹配C:\ Users \ me \ .kivy \ garden \ garden.garvig.navigationdrawer \ __ init__.py 从C:\ Users \ me \ .kivy \ garden \ garden.navigationdrawer \ __ init __.pyc""

"""directory C:\Users\me\.kivy\garden\garden.navigationdrawer C:\Users\me\.kivy\garden\garden.navigationdrawer\__init__.pyc matches C:\Users\me\.kivy\garden\garden.navigationdrawer\__init__.py import kivy.garden.navigationdrawer # precompiled from C:\Users\me\.kivy\garden\garden.navigationdrawer\__init__.pyc"""

但是,不!我不希望您从c:\ users导入它们.我希望它们像所有其他导入一样被很好地复制到我的dist文件夹中.我尝试将c:\ users \ me添加到PyInstaller的pathex,系统PATH和PYTHONPATH中而没有任何乐趣.有人有什么想法吗?

But noo! I don't want you to import them from c:\users. I want them to get nicely copied into my dist folder like all the other imports. I've tried adding c:\users\me to PyInstaller's pathex, the system PATH and PYTHONPATH without any joy. Anyone have any ideas?

推荐答案

尝试将您的花园包装安装到您的应用中.即

Try installing your garden packages into your app. i.e.

garden install --app navigationdrawer

这将在当前目录中创建一个libs/garden文件夹,并将花园包放置在其中,这将使其更容易包含.

This will create a libs/garden folder inside the current directory and place the garden packages in there, which should make it easier to include.

这篇关于PyInstaller中的Kivy Garden-尝试跟踪导入时卡住了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆