首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ModuleNotFoundError:没有名为“kivymd.stiffscroll”的模块

ModuleNotFoundError:没有名为“kivymd.stiffscroll”的模块
EN

Stack Overflow用户
提问于 2022-01-17 13:43:33
回答 1查看 480关注 0票数 0

可能的解决方案:我安装的kivymd仅在终端上,而不是在IDE (Pycharm)的Python解释器上。我对此不太确定,因为首先,我在我的终端上安装了kivymd,并将kivy包手动添加到了我的IDE的Python解释器上。第二,我的Python解释器位于"/Desktop/CoinSnack4/venv/bin/python“,而我的kivymd安装在我的终端上的"/Users/kienletrung/Desktop/CoinSnack4/venv”(我在终端上输入了"echo $VIRTUAL_ENV“)。

也是,我的程序在使用IDE运行时运行得很好。下面的错误只在我打开它的.exe文件.时发生

嗨,请大家帮忙,我的exe文件正在弹出这个错误:

这个堆栈溢出(No module named kivymd.effects when using pyinstaller)的答案对我没有用.

代码语言:javascript
运行
复制
[INFO   ] [Logger      ] Record log in /Users/kienletrung/.kivy/logs/kivy_22-01-18_0.txt
[INFO   ] [Kivy        ] v2.0.0
[INFO   ] [Kivy        ] Installed at "/var/folders/g4/1xyrvs4j721f0tlsddrbxch00000gn/T/_MEI2YvYUa/kivy/__init__.pyc"
[INFO   ] [Python      ] v3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) 
[Clang 6.0 (clang-600.0.57)]
[INFO   ] [Python      ] Interpreter at "/Users/kienletrung/Desktop/CoinSnack4/dist/financiaz"
[INFO   ] [Factory     ] 186 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_imageio, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO   ] [KivyMD      ] 0.104.2.dev0 (installed at "/var/folders/g4/1xyrvs4j721f0tlsddrbxch00000gn/T/_MEI2YvYUa/kivymd/__init__.pyc")
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
[INFO   ] [GL          ] Backend used <sdl2>
[INFO   ] [GL          ] OpenGL version <b'2.1 INTEL-14.7.18'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel Inc.'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 6000'>
[INFO   ] [GL          ] OpenGL parsed version: 2, 1
[INFO   ] [GL          ] Shading version <b'1.20'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <16>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[ERROR  ] 
Traceback (most recent call last):
  File "kivy/lang/parser.py", line 472, in execute_directives
ModuleNotFoundError: No module named 'kivymd.stiffscroll'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "kivy/lang/parser.py", line 474, in execute_directives
ModuleNotFoundError: No module named 'kivymd.stiffscroll'
 Traceback (most recent call last):
   File "kivy/lang/parser.py", line 472, in execute_directives
 ModuleNotFoundError: No module named 'kivymd.stiffscroll'
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):
   File "kivy/lang/parser.py", line 474, in execute_directives
 ModuleNotFoundError: No module named 'kivymd.stiffscroll'
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):
   File "main.py", line 24, in <module>
   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
   File "PyInstaller/loader/pyimod03_importers.py", line 540, in exec_module
   File "kivymd/uix/datatables.py", line 54, in <module>
   File "kivy/lang/builder.py", line 373, in load_string
   File "kivy/lang/parser.py", line 402, in __init__
   File "kivy/lang/parser.py", line 508, in parse
   File "kivy/lang/parser.py", line 483, in execute_directives
 kivy.lang.parser.ParserException: Parser: File "<inline>", line 3:
 ...
       1:
       2:#:import DEVICE_TYPE kivymd.material_resources.DEVICE_TYPE
 >>    3:#:import StiffScrollEffect kivymd.stiffscroll.StiffScrollEffect
       4:
       5:
 ...
 Unable to import package 'kivymd.stiffscroll.StiffScrollEffect'
[8390] Failed to execute script main
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

似乎发生此错误的原因是kivymd/uix/database.py中的database.py文件无法使代码"#:import StiffScrollEffect kivymd.stiffscroll.StiffScrollEffect“因某种原因而工作!

如果有帮助,这是我的规范文件:

代码语言:javascript
运行
复制
# -*- mode: python ; coding: utf-8 -*-

from kivymd import hooks_path as kivymd_hooks_path
block_cipher = None


#changes the '/Users/kienletrung/Desktop/CoinSnack_MiniIA/main.py' below to the
#path to the python python file of the whole project. change the #'/Users/kienletrung/Desktop/CoinSnack_MiniIA' below to the folder that holds the previous python file.
a = Analysis(['/Users/kienletrung/Desktop/FinanciazIA/main.py'],
             pathex=['/Users/kienletrung/Desktop/FinanciazIA'],
             binaries=[],
             datas=[],
             hiddenimports=["kivymd"],
             hookspath=[kivymd_hooks_path],
             runtime_hooks=[],
             excludes=['_tkinter', 'Tkinter', 'enchant', 'twisted'],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

#adds other files that are not the main python file with the way below: (needs to change the #'/Users/kienletrung/Desktop/CoinSnack_MiniIA/main.kv' to the appropriate path to the file)
a.datas += [('main.kv', '/Users/kienletrung/Desktop/FinanciazIA/main.kv', 'DATA'), ('Financiaz.png', '/Users/kienletrung/Desktop/FinanciazIA/Financiaz.png', 'DATA')]

#needs to change '/Users/kienletrung/Desktop/CoinSnack_MiniIA' to the path that holds the data that I add in the above line. change the "coinsnack" name to appropriate app name.
exe = EXE(pyz, Tree('/Users/kienletrung/Desktop/FinanciazIA', 'Data'),
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name='financiaz',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=False )
app = BUNDLE(exe,
             name='financiaz.app',
             icon=None,
             bundle_identifier=None)

我试了好几天,但还是解决不了这个问题.如果你能帮我,我将永远感激。非常感谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-01-17 20:53:48

代码语言:javascript
运行
复制
pip uninstall kivymd
pip install https://github.com/kivymd/KivyMD/archive/master.zip
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70742358

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档