<legend id='kjdo6'><style id='kjdo6'><dir id='kjdo6'><q id='kjdo6'></q></dir></style></legend>
    • <bdo id='kjdo6'></bdo><ul id='kjdo6'></ul>

    1. <tfoot id='kjdo6'></tfoot>

      1. <small id='kjdo6'></small><noframes id='kjdo6'>

        <i id='kjdo6'><tr id='kjdo6'><dt id='kjdo6'><q id='kjdo6'><span id='kjdo6'><b id='kjdo6'><form id='kjdo6'><ins id='kjdo6'></ins><ul id='kjdo6'></ul><sub id='kjdo6'></sub></form><legend id='kjdo6'></legend><bdo id='kjdo6'><pre id='kjdo6'><center id='kjdo6'></center></pre></bdo></b><th id='kjdo6'></th></span></q></dt></tr></i><div id='kjdo6'><tfoot id='kjdo6'></tfoot><dl id='kjdo6'><fieldset id='kjdo6'></fieldset></dl></div>
      2. Raspberry Pi Python (Kivy) 使用 sudo 非常慢

        时间:2023-10-09

            1. <small id='F3Nui'></small><noframes id='F3Nui'>

              <legend id='F3Nui'><style id='F3Nui'><dir id='F3Nui'><q id='F3Nui'></q></dir></style></legend>
              <i id='F3Nui'><tr id='F3Nui'><dt id='F3Nui'><q id='F3Nui'><span id='F3Nui'><b id='F3Nui'><form id='F3Nui'><ins id='F3Nui'></ins><ul id='F3Nui'></ul><sub id='F3Nui'></sub></form><legend id='F3Nui'></legend><bdo id='F3Nui'><pre id='F3Nui'><center id='F3Nui'></center></pre></bdo></b><th id='F3Nui'></th></span></q></dt></tr></i><div id='F3Nui'><tfoot id='F3Nui'></tfoot><dl id='F3Nui'><fieldset id='F3Nui'></fieldset></dl></div>
              <tfoot id='F3Nui'></tfoot>

                  <tbody id='F3Nui'></tbody>
                • <bdo id='F3Nui'></bdo><ul id='F3Nui'></ul>

                  本文介绍了Raspberry Pi Python (Kivy) 使用 sudo 非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我一直在使用 KivyPie OS(为 Kivy 开发预配置 Linux)在 Raspberry Pi 上编写 Kivy 图形程序.

                  I've been writing a Kivy graphical program on Raspberry Pi, with the KivyPie OS (Linux pre-configured for Kivy development).

                  由于某种原因,如果使用 sudo 启动,它的运行速度会非常慢.通常,运行python main.py",程序每秒运行大约 30 个周期.但是,如果我执行sudo python main.py",它会以每 5-10 秒 1 个周期的速度运行.

                  For some reason, it's running extremely slow if started with sudo. Normally, running "python main.py", the program runs at about 30 cycles per second. However, if I do "sudo python main.py", it runs as slowly as 1 cycle per 5-10 seconds.

                  我需要使用 sudo 来访问 Raspberry 的 GPIO.(除非我尝试其他方法,否则我会看到人们讨论).

                  I need to use sudo to access Raspberry's GPIO. (unless I try some other way to do it, that I see people discuss).

                  不过,我很感兴趣,使用 sudo 导致性能大幅下降的原因可能是什么?有没有可能解决这个问题?

                  I'm interested, though, what could be the cause of such a massive performance drop with sudo? And is it possible to work around that?

                  PS:在我的 PC (Linux) 上运行相同的程序,无论是否使用 sudo,似乎都不会导致此类问题.仅在覆盆子上.

                  PS: Running the same program on my PC (Linux) with and without sudo doesn't seem to cause such problem. Only on Raspberry.

                  推荐答案

                  好吧,我认为这个问题已经解决了,即使还有一些问题.

                  Well, I would call this problem solved, even if a few questions remain.

                  以下是重点:

                  • 速度变慢的原因是 Kivy 无法在sudo"下加载正确的视频驱动程序,而是使用软件渲染.
                  • 我还没有弄清楚为什么驱动程序没有加载 sudo 或如何修复它.不过……
                  • 使用 Pyinstaller 编译程序后,一切正常.可执行文件可以使用 sudo 启动,GPIO 正在工作,Kivy 加载了适当的驱动程序,一切都运行得很快,应该如此.

                  总结一下,一开始问题的原因已经找到了,目前还没有找到直接用Python启动程序的解决办法,但是用Pyinstaller编译程序解决了这个问题.(不过,这不是一种方便的调试方式.)

                  To sum it up, the reason of the initial problem has been found, no fix for launching the program directly with Python was yet found, but the problem was removed by compiling the program with Pyinstaller. (still, not a convenient way for debugging.)

                  这篇关于Raspberry Pi Python (Kivy) 使用 sudo 非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:为什么不能从 Kivy 终止这个 Python 多处理进程? 下一篇:Kivy 刷新布局(异步加载)

                  相关文章

                  最新文章

                  <small id='A7cja'></small><noframes id='A7cja'>

                      <bdo id='A7cja'></bdo><ul id='A7cja'></ul>

                    <tfoot id='A7cja'></tfoot>
                    <legend id='A7cja'><style id='A7cja'><dir id='A7cja'><q id='A7cja'></q></dir></style></legend>
                  1. <i id='A7cja'><tr id='A7cja'><dt id='A7cja'><q id='A7cja'><span id='A7cja'><b id='A7cja'><form id='A7cja'><ins id='A7cja'></ins><ul id='A7cja'></ul><sub id='A7cja'></sub></form><legend id='A7cja'></legend><bdo id='A7cja'><pre id='A7cja'><center id='A7cja'></center></pre></bdo></b><th id='A7cja'></th></span></q></dt></tr></i><div id='A7cja'><tfoot id='A7cja'></tfoot><dl id='A7cja'><fieldset id='A7cja'></fieldset></dl></div>