PyQt4.QtCore doesn't contain many of its classes and attributes
I have built PyQt4 from source and everything went smoothly until I tried to use some of the classes and attributes located in QtCore. For some reason QtCore is missing a lot of functionality and data that should be there. For example from PyQt4.QtCore import QT_VERSION_STR is an import error. There were no errors or warnings given when building the package开发者_如何学Cs and I have also tried with the PyQt packages from yum but I have the same problem.
Has anyone else encountered this problem before?
Thanks.
If it's really an ImportError
, that suggests that it's failing to import the library altogether. Check that it's definitely somewhere that's in your sys.path
, and that from PyQt4 import QtCore
works.
If the library exists, and QT_VERSION_STR doesn't exist, it will give you a NameError
rather than an ImportError
.
The reason for this problem was a conflict in my python path. I had two modules named sip.py in different locations on my python path, the python path was using the first one but I wanted it to use the second one. I removed the first entry from the python path as it wasn't necessary.
精彩评论