简体   繁体   English

Kivy Buildozer python3 错误:“ImportError: No module named 'requests'”

[英]Kivy Buildozer python3 error: " ImportError: No module named 'requests' "

I'm trying to build a simple kivy app with buildozer and python3, but for some reason inside this build no module 'requests'.我正在尝试使用 buildozer 和 python3 构建一个简单的 kivy 应用程序,但由于某种原因在这个构建中没有模块“请求”。 I have tried to manually include this module as "required" for build in python, but this caused the error as far as 'requests" is already included in python3. I'm not sure on which side this problem is: buildozer or python-for-android.我试图手动将此模块作为“必需”包含在 python 中,但这导致了错误,因为“请求”已经包含在 python3 中。我不确定这个问题是在哪一边:buildozer 或 python-对于安卓。

Source:资源:

from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.scatter import Scatter
import requests

class TutorialApp(App):
    def build(self):
        f = FloatLayout()
        s = Scatter()
        l = Label(text='Hello!',
              font_size=150)

        f.add_widget(s)
        s.add_widget(l)
        return f

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

Log from logcat:从 logcat 登录:

09-19 16:50:50.429 14737 14756 I python: [INFO ] [Text ] Provider: sdl2 09-19 16:50:50.429 14737 14756 I python: [INFO] [Text] Provider: sdl2

09-19 16:50:50.442 14737 14756 I python: Traceback (most recent call last): 09-19 16:50:50.442 14737 14756 I python: Traceback(最后一次调用):

09-19 16:50:50.442 14737 14756 I python: File "main.py", line 5, in 09-19 16:50:50.442 14737 14756 I python: 文件“main.py”,第 5 行,在

09-19 16:50:50.444 14737 14756 I python: import requests 09-19 16:50:50.444 14737 14756 I python: 导入请求

09-19 16:50:50.444 14737 14756 I python: ImportError: No module named 'requests' 09-19 16:50:50.444 14737 14756 I python: ImportError: No module named 'requests'

09-19 16:50:50.508 14737 14756 I python: Python for android ended. 09-19 16:50:50.508 14737 14756 I python: Python for android 结束。

just add the following directory to the project只需将以下目录添加到项目中

charset_normalizer, idna, urllib3, requests, charset_normalizer, idna, urllib3, 请求,

it work for me它对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM