构建 kivy 应用程序时出错:模块未找到错误:没有名为"typing_extensions"的模块



我正在尝试为android打包一个Kivy应用程序。这是我试图编译的代码:

from pytube import YouTube
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button

def download(url):
try: 
yt = YouTube(url)
vids = yt.streams.order_by('resolution')
#formVids = []
if len(vids) > 0:
print("Downloading...")
vids.first().download()
print("Video Downloaded")
else:
print("Couldn't download that video")
except Exception as e:
print("Failed to download video: ", e)

class MyGrid(GridLayout):
def __init__(self, **kwargs):
super(MyGrid, self).__init__(**kwargs)
self.cols = 1
self.inside = GridLayout()
self.inside.cols = 2
self.add_widget(Label(text="Note: Downloading Youtube videos is against Youtubes terms of service. nDownload videos only if the creator is okay with it. E.g., a lot of gaming channels nare okay with fans downloading content in order to make compilations. nAlso not that downloading copyrighted content (songs, movies, etc) is a criminal offense.", halign = "center"))
self.add_widget(Label(text="Paste the url of the video in the whitespace below"))
self.name = TextInput(multiline=False)
self.add_widget(self.name)
self.submit = Button(text="Download", font_size=60)
self.submit.bind(on_press=self.pressed)
self.add_widget(self.submit)
def pressed(self, instance):
url = self.name.text
download(url)
print(url)
class MyApp(App):
def build(self):
return MyGrid()

if __name__ == "__main__":
MyApp().run()

这是一个完整的错误:

Android kivy bootstrap done. __name__ is __main__
09-01 12:07:54.268 17974 18054 I python  : AND: Ran string
09-01 12:07:54.268 17974 18054 I python  : Run user program, change dir and execute entrypoint
09-01 12:07:54.444 17974 18054 I python  : Traceback (most recent call last):
09-01 12:07:54.444 17974 18054 I python  :   File "/home/joshua/youtubeDownloader/.buildozer/android/app/main.py", line 1, in <module>
09-01 12:07:54.445 17974 18054 I python  :   File "/home/joshua/youtubeDownloader/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/youtubeDownloader/pytube/__init__.py", line 13, in <module>
09-01 12:07:54.445 17974 18054 I python  :   File "/home/joshua/youtubeDownloader/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/youtubeDownloader/pytube/streams.py", line 22, in <module>
09-01 12:07:54.445 17974 18054 I python  :   File "/home/joshua/youtubeDownloader/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/youtubeDownloader/pytube/monostate.py", line 4, in <module>
09-01 12:07:54.445 17974 18054 I python  : ModuleNotFoundError: No module named 'typing_extensions'
09-01 12:07:54.445 17974 18054 I python  : Python for android ended.

我尝试在requirements说明符旁边的buildozer.spec文件中添加"typeing_extensions",但也不起作用。如果有任何关于为什么会发生这种情况和/或如何解决的帮助,我们将不胜感激!

尝试使用重新安装typeing_extensions包

pip uninstall typing_extensions 
pip install typing_extensions 

我真的不确定我的答案,但是,

也许您可以尝试将typing-extensions而不是typing_extensions放在builder.spec文件中。

用CCD_ 6代替CCD_。

相关内容

  • 没有找到相关文章

最新更新