Frage

I'm following Kivy's Windows-packaging guide. I'm at the last step, building the spec, and I get the following error:

ImportError: No module named kivy.tools.packaging.pyinstaller_hooks

I'm using Python 2.7.5, the Kivy 1.7.2 for Windows, and the PyInstaller 2.1. All previous steps of the guide work. For this guide, I'm packaging up my Pong game, which I made using Kivy's Pong game tutorial. I stopped the tutorial at the point where the ball is only bouncing around, but it's technically a working program using Kivy, so it should be good enough to practice packaging.

I've looked at this post in the Kivy support area, and it doesn't help. (The files listed in that post as being missing, are present in my Kivy download.)

Where do I find the module in the error message, and how to I tell PyInstaller where to find it?

War es hilfreich?

Lösung 3

Running kivy.bat before running pyinstaller.py will fix the error.

This batch file sets the appropriate paths, so that pyinstaller knows where to find Kivy. This step is listed in the tutorial; It is essential that no steps are missed.

Andere Tipps

If your OS is Ubuntu and you installed kivy via the ppa-repository, you should do sudo apt install kivy-tools.

Try adding this to the top of your .spec file:

import kivy

If that generates an error when you run pyinstaller, you probably haven't setup your environment correctly.

Specifically, you're probably using a pyinstaller from C:\Python\ instead of C:\blah\Kivy\bin...

The easiest way to get this to work is to install an MSYS shell, and do it like this:

. /c/blah/kivyenv.sh
pip install pyinstaller
pyinstaller main.spec

I've only had grief with the default terminal (ie. non MSYS), so if you're using that I'm afraid I'm got no idea.

If your OS is ubuntu, go to kivy git repository

kivy tools/packaging

and copy/past files to this directory

/usr/lib/python2.7/dist-packages/kivy/tools/packaging/

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top