我想用python来使用qt。 “import qt”return me:“ImportError:No module named qt”。 我已经安装pyqt。
我必须安装以激活“导入qt”
谢谢
I want to use qt with python. "import qt" return me :"ImportError: No module named qt". I already instaled pyqt.
what I hve to install in order to activate "import qt"
Thank You
最满意答案
目前的PyQt来自PyQt4包,它有几个模块。 你几乎总是需要从以下开始:
from PyQt4 import QtCore from PyQt4 import QtGui如果您需要额外的PyQt子模块(如QtNetwork , QtSql等),则根据需要添加其他导入。
提示未来:找到Python安装的lib/site-packages库,并在安装后不确定名称时查看其中的软件包。
另外,用PyQt教程武装自己 - 任何体面的人都会在前几段中介绍这一点。
The current PyQt comes in the PyQt4 package, which has several modules. You almost always need to start with:
from PyQt4 import QtCore from PyQt4 import QtGuiAdd other imports as necessary if you need additional sub-modules of PyQt (like QtNetwork, QtSql etc).
Tip for the future: find the lib/site-packages library of your Python installation and look at the packages in there if you're not sure about the name after installing.
Also, arm yourself with a PyQt tutorial - any decent one covers this in the first few paragraphs.
更多推荐
发布评论