Kivy- Packaging to Windows fails: “No module named

2019-02-19 23:19发布

I am trying to package a kivy application for Windows, and after following the instructions in the Kivy website for the example TouchTracer app, I get an ImportError: No Module named ConfigParser message when trying to open the .exe file in the dist folder.

I am running Python 2.7.11 and kivy 1.9.1.

Also, while executing the command python -m PyInstaller..., the output includes a line that says:

12612 WARNING: Attempted to add Python module twice with different upper/lowercases: ConfigParser

Below is the traceback printed when attempting to open the .exe file.

Traceback (most recent call last):
   File "C:\Users\acasall1\Desktop\TouchApp\demo\touchtracer\main.py", line 22,
in <module>
     import kivy
   File "c:\users\acasall1\appdata\local\temp\pip-build-21skkd\pyinstaller\PyIns
taller\loader\pyimod03_importers.py", line 389, in load_module
   File "c:\python27\lib\site-packages\kivy\__init__.py", line 306, in <module>
     from kivy.config import Config
   File "c:\users\acasall1\appdata\local\temp\pip-build-21skkd\pyinstaller\PyIns
taller\loader\pyimod03_importers.py", line 389, in load_module
   File "c:\python27\lib\site-packages\kivy\config.py", line 284, in <module>
     from configparser import RawConfigParser as PythonConfigParser
   File "c:\users\acasall1\appdata\local\temp\pip-build-21skkd\pyinstaller\PyIns
taller\loader\pyimod03_importers.py", line 389, in load_module
   File "C:\Python27\lib\site-packages\configparser\__init__.py", line 5, in <mo
dule>
     from ConfigParser import *
 ImportError: No module named ConfigParser
Failed to execute script main

1条回答
啃猪蹄的小仙女
2楼-- · 2019-02-19 23:37

I had the same problem for my kivy application, and I found an ad hoc solution. The error comes from the line "import kivy", so uncomment it and the next line "kivy.require('1.0.6')". There lines are unnecessary if your kivy has proper version.

查看更多
登录 后发表回答