I have an apparently older version of PyQt5 installed on my Xubuntu (Voyager). When I print the PYQT_VERSION_STR
, it displays: '5.2.1'
. I downloaded the latest PyQt5 release form here: http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.4/
I configured it, make and make installed it, everything went according to plan. However, if I print the PYQT_VERSION_STR
again, it still outputs '5.2.1'
.
How do I tell my python3.4 to use the updated version?
(Shouldn't the reinstall of the new version overwrite the other one? I don't understand why it is still showing 5.2.1 as version string.)
EDIT #1:
sys.path
:
['', '/home/user/.pythonbrew/lib', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/usr/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/dist-packages', '/usr/lib/python3/dist-packages']
PyQt5.__file__
'/usr/lib/python3/dist-packages/PyQt5/init.py'
So it seems my python is using the version from the repositories, except if that's where it got installed when make installing.
EDIT #2:
It seems that the PYQT_VERSION_STR
returns the version of Qt (!) which the PyQt5 configuration before making and make installing found. So the actual issue seems to be with my Qt5 version, which is 5.2.1
according to the output of python configure
of PyQt5:
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
This is the GPL version of PyQt 5.4 (licensed under the GNU General Public License) for Python 3.4.0 on linux.
Type 'L' to view the license.
Type 'yes' to accept the terms of the license.
Type 'no' to decline the terms of the license.
Do you accept the terms of the license? yes
Found the license file pyqt-gpl.sip.
Checking [...]
DBus v1 does not seem to be installed.
Qt v5.2.1 (Open Source) is being used.
The qmake executable is /usr/bin/qmake.
Qt is built as a shared library.
SIP 4.16.5 is being used.
The sip executable is /usr/bin/sip.
These PyQt5 modules will be built: QtCore, QtGui, QtNetwork, QtOpenGL,
QtPrintSupport, QtQml, QtQuick, QtSql, QtTest, QtWidgets, QtXml, QtDBus, _QOpenGLFunctions_2_0.
The PyQt5 Python package will be installed in /usr/lib/python3.4/site-packages.
PyQt5 is being built with generated docstrings.
PyQt5 is being built with 'protected' redefined as 'public'.
The Designer plugin will be installed in
/usr/lib/x86_64-linux-gnu/qt5/plugins/designer.
The qmlscene plugin will be installed in
/usr/lib/x86_64-linux-gnu/qt5/plugins/PyQt5.
The PyQt5 .sip files will be installed in /usr/share/sip/PyQt5.
pyuic5, pyrcc5 and pylupdate5 will be installed in /usr/bin.
The interpreter used by pyuic5 is /usr/bin/python3.
Generating the C++ source for the QtCore module...
Embedding sip flags...
Generating [...]
Re-writing
/home/xiaolong/Downloads/PyQt-gpl-5.4/examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir...
Generating the top-level .pro file...
Making the pyuic5 wrapper executable...
Generating the Makefiles...
So the PyQt5 is going into the correct directory, but the actual version of Qt5 is older than 5.4. Now the question seems turns into "How do I update my Qt5 version?" unless I misunderstood something here.
EDIT #3:
Output of sys.executable
:
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'/usr/bin/python3'
>>>
EDIT #4:
Contents of my .bash_aliases
file:
alias python=python3
alias pip=pip3
apt-get update
followed byapt-get upgrade
? – Alex MartelliPYTHONPATH
from where your locally installed (newer) version gets placed. Check the__file__
from which the older PyQt version gets loaded vs the directory where the newer one got installed, and in what order the dirs are insys.path
. – Alex Martellisys.path
doesn't seem to have any other directory than the site packages:['', '/home/user/.pythonbrew/lib', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/usr/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/dist-packages', '/usr/lib/python3/dist-packages']
How do I check the__file__
from which it is loaded? – Zelphir Kaltstahlimport PyQt5
from an interactive Python interpreter, and showPyQt5.__file__
. – Alex Martelli