<tfoot id='VwsVR'></tfoot>

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

        <legend id='VwsVR'><style id='VwsVR'><dir id='VwsVR'><q id='VwsVR'></q></dir></style></legend>
      2. Pylint 中的模块“PyQt5.QtWidgets"错误中没有名称

        时间:2023-08-07

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

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

              <legend id='I5SMG'><style id='I5SMG'><dir id='I5SMG'><q id='I5SMG'></q></dir></style></legend>
                <tfoot id='I5SMG'></tfoot>

                • 本文介绍了Pylint 中的模块“PyQt5.QtWidgets"错误中没有名称“QApplication"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在尝试学习 PyQt5 时在 VS Code 中遇到此问题,模块 'PyQt5.QtWidgets' 中没有名称 'QApplication'",模块 'PyQt5.QtWidgets' 中没有名称 'QWidget'".

                  Running into this issue in VS Code while trying to learn PyQt5, "No name 'QApplication' in module 'PyQt5.QtWidgets'", "No name 'QWidget' in module 'PyQt5.QtWidgets'"".

                  我不确定这是 pylint 问题还是其他问题.我已经确认 PyQt5 安装了 pip3 列表,但我似乎无法找出问题所在.

                  I'm not sure if this is a pylint issue or something else. I've confirmed PyQt5 is installed with pip3 list but I can't seem to figure out the issue.

                  import sys
                  from PyQt5.QtWidgets import QApplication, QWidget
                  
                  def app():
                    my_app = QApplication(sys.argv)
                    w = QWidget()
                    w.setWindowTitle("Test")
                    w.show()
                    sys.exit(my_app.exec_())
                  app()
                  

                  我希望这个错误不会继续显示,但它会阻止我在 VS Code 中运行东西.任何帮助或建议表示赞赏.

                  I'd expect this error to not keep displaying but its preventing me from running things in VS Code. Any help or suggestions appreciated.

                  推荐答案

                  我已经解决了这个问题,显然 Pylint 默认不加载任何 C 扩展,因为它们可以运行任意代码. 所以我发现如果你在你的项目目录中创建一个名为 .pylintrc 的文件的系统文件,rc 文件可以通过在 rc 文件中添加以下代码来将这个包列入白名单以停止抛出错误 extension-pkg-whitelist=PyQt5.所以本质上问题不是 PyQt5,而是由于这个原因导致的 linter 抛出错误错误.

                  I've figured out the issue, apparently Pylint doesn't load any C extensions by default, because those can run arbitrary code. So I found that if you create a system file in your project directory with the file named .pylintrc the rc file can whitelist this package to stop throwing errors by adding the following code in the rc file extension-pkg-whitelist=PyQt5. So essentially the issue isn't PyQt5, it was the linter throwing false errors due to this.

                  这篇关于Pylint 中的模块“PyQt5.QtWidgets"错误中没有名称“QApplication"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Pyqt5 qthread + 信号不工作 + gui 冻结 下一篇:在字符串中按下 QpushButton 时如何在 QlineEdit 中获

                  相关文章

                  最新文章

                      <bdo id='pzt0J'></bdo><ul id='pzt0J'></ul>
                    <tfoot id='pzt0J'></tfoot>
                  1. <small id='pzt0J'></small><noframes id='pzt0J'>

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

                    1. <legend id='pzt0J'><style id='pzt0J'><dir id='pzt0J'><q id='pzt0J'></q></dir></style></legend>