Tutorial on python3.3 + eric5 + PyQt4 + Qscintilla2 + sip4.15 in Ubuntu12.04

Source: Internet
Author: User

I have to say that it is the least time to learn Python. It was originally intended for the simplicity of Python. Now, due to the bottleneck of language development, two incompatible versions have to be divided.

As a result, I am not going to hell. Here, eric5 is our Python IDE and PyQt4 is the class for Qt interface development. While QT is a platform-based graphical user interface program. If it is called in Python, it must call the Python tool-SIP of the C/C ++ module, qscintilla2 is the interface connecting the compiler and Python. Therefore, the above must be installed in a complete development environment.

Here, we will install the python 3 development environment as an example. The most important issue is the version issue. Python3 must support corresponding class libraries of Python3.

Installation sequence:

Python3.3

Download URL: http://www.python.org/downloads/

Quick download; http://www.python.org/ftp/python/3.3.5/Python-3.3.5rc1.tar.xz

Sip4.15

Download URL: http://www.riverbankcomputing.co.uk/software/sip/download

Download: http://sourceforge.net/projects/pyqt/files/sip/sip-4.15.4/sip-4.15.4.tar.gz

PyQt4

Download URL: http://www.riverbankcomputing.co.uk/software/pyqt/download

Download: http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.10.3/PyQt-x11-gpl-4.10.3.tar.gz

Qscintilla2

Download URL: http://www.riverbankcomputing.co.uk/software/qscintilla/download

Download: http://sourceforge.net/projects/pyqt/files/QScintilla2/QScintilla-2.8/QScintilla-gpl-2.8.tar.gz


Eric5

Download URL: http://eric-ide.python-projects.org/eric-download.html

Download: http://sourceforge.net/projects/eric-ide/files/eric5/stable/

The most important two sentences of Eirc: eric4 pludes a plugin system, which allows easy extension of the IDE functionality with plugins downloadable from the net.

Current stable versions are eric4 based on Qt4 and Python 2 and eric5 based on Python 3 and Qt4.

Eric4 includes a plug-in system that allows us to expand our IDE by downloading it over the Internet.

The current stable version of Eric4 is based on QT4 and Python2, while Eric5 is based on Python3 and QT4.

Install Python3

Because Python2 is installed in Linux by default, many applications will be related to it. However, Python3 is not compatible with Python2, which may cause inexplicable errors in many applications, therefore, our installation causes the two to coexist:

Tar-xavf Python-3.3.5rc1.tar.xz cd Python-3.3.5rc1.tar.xz sudo mkdir/usr/local/python3. /configure -- prefix =/usr/local/python3 sudo make & sudo make install ln-s/usr/local/python3/bin/python3/usr/bin/python3 python and python3 Testing


Install sip4.15

Tar-xavf sip-4.15.4.tar.gzcd sip-4.15.4python3 configure. pymakesudo make install here we need to pay attention to find the installation parameters, such as the default installation path and other information, the command is: python3 configure. py-h
Install PyQt4

tar -xavf PyQt-x11-gpl-4.10.3.tar.gzcd PyQt-x11-gpl-4.10.3python3 configure.py  makesudo make install


Install Qscintilla2

tar -xzvf QScintilla-gpl-2.8.tar.gzcd QScintilla-gpl-2.8cd Qt4Qt5qmake qscintilla.promakemake installcd ../Pythonpython configure.py makesudo make installcd ../designer-Qt4Qt5qmake designer.pro makesudo make install

Install Eric5

tar -xavf   eric5-5.4.0.tar.gz  cd   eric5-5.4.0sudo python3 install.py
Generally, you will encounter Unable to Import "PyQt4" in this step"

How can I find the PyQt4 module if I have installed it successfully?

The main reason is that the sip version of PyQt4 we installed earlier is incorrect, because the default installation location of PyQt4 is/usr/share/sip/PyQt4.

We can find that many. sip files are converted from C ++ to the Qt library. Here we can run from PyQt4.QtCore import * under python2 and python3 *

It will be found that python2 is normal, and python3 is abnormal, because there is an existing installed version of sip in the system, input


The old version is used by default. How can this problem be solved?

That is, when QScintilla2 and PyQt4 are used, you can use the-h command to view

Replace all the files configured with configure. py with the following command:

Python3 configure. py -- sip =/usr/local/python3/bin/sip

Summary:

When installing an application, we recommend that you use the source code to install the application. This gives you more control over the installation environment, and many bugs may be corrected by software updates.

Unless the entire set of dependent software exists in the software center, it is easy to see a library mismatch, and the residual files will also affect the source code installation.

Python library path settings can be set permanently by configuring in environment variables, PYTHONPATH, or through

Import sys

Sys. path. append ('path ')

To temporarily add

Use print (sys. path) to view the configured environment.

The last figure is shown below:



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.