What to do if such import error occurs?
>>> import PySide
>>> from PySide import QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name QtCore
>>> from PySide import QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name QtCore
1. Try to locate where your pyside is installed:
$ locate PySide
...
/usr/lib/python2.7/dist-packages/PySide
/usr/lib/python2.7/dist-packages/PySide/__init__.py
/usr/lib/python2.7/dist-packages/PySide/__init__.pyc
/usr/lib/python2.7/dist-packages/PySide/phonon.so
/usr/lib/python2.7/dist-packages/PySide/QtCore.so
/usr/lib/python2.7/dist-packages/PySide/QtDeclarative.so
/usr/lib/python2.7/dist-packages/PySide/QtGui.so
/usr/lib/python2.7/dist-packages/PySide/QtHelp.so
/usr/lib/python2.7/dist-packages/PySide/__init__.py
/usr/lib/python2.7/dist-packages/PySide/__init__.pyc
/usr/lib/python2.7/dist-packages/PySide/phonon.so
/usr/lib/python2.7/dist-packages/PySide/QtCore.so
/usr/lib/python2.7/dist-packages/PySide/QtDeclarative.so
/usr/lib/python2.7/dist-packages/PySide/QtGui.so
/usr/lib/python2.7/dist-packages/PySide/QtHelp.so
...
Hint: use this to update your file index:
$ sudo updatedb
Hint: use this to update your file index:
$ sudo updatedb
2. The solution is easy: add this to your ~/.bashrc (or ~/.<shell>rc you actually have).
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/python2.7/dist-packages/PySide
Comments
Post a Comment
Please be relevant, helpful and nice.