centos安装eric4出现“No module named QtHelp”的解决办法

安装eric4,按照eric4的说明文档安装,安装顺序如下:

            1. Install Qt4           
            2. Build and install sip           
            3. Build and install QScintilla2           
            4. Build and install PyQt4           
            5. Build and install QScintilla2 Python bindings           
            6. Install eric4

Qt版本我安装的Qt5,其他的按照顺序安装下来。但是到安装eric4时提示“No module named QtHelp”的错误,具体错误提示如下:

Checking dependencies
Python Version: 2.7.3
Found PyQt4
Sorry, please install QtHelp.
Error: No module named QtHelp

google和度娘了无数把也没找到个解决办法。一开始以为是安装Qt5的时候漏安装QtHelp了,但是重新安装Qt5时怎么也找不到QtHelp,后来发现这个QtHelp应该是PyQt4的组件。重新安装PyQt4,结果发现运行

Python configure.py

时有检查QtHelp组件:

Checking to see if the QtHelp module should be built...


但是检查的结果是不用安装QtHelp,具体是怎么判断的就不是很清楚了:

These PyQt modules will be built: QtCore, QtGui, QtMultimedia, QtNetwork,
QtDBus, QtDeclarative, QtOpenGL, QtScript, QtScriptTools, QtSql, QtSvg, QtTest,
QtXml, QtXmlPatterns, QtDesigner.
The PyQt Python package will be installed in

所以呢,就从configure.py文件入手吧,打开configure.py,有一个检查组件是否需要安装的函数如下:

def check_module(mname, incfile, test, extra_include_dirs=None, extra_lib_dirs=None, extra_libs=None):
    """See if a module can be built and, if so, add it to the global list of
    modules.

    mname is the name of the module.
    incfile is the name of the include file needed for the test.
    test is a C++ statement being used for the test.
    extra_include_dirs is an optional list of extra include directories.
    extra_lib_dirs is an optional list of extra library directories.
    extra_libs is an optional list of extra libraries.
    """
    # Check that the module is enabled if we are not automatically enabling all
    # modules.
    if len(opts.enabled) > 0 and mname not in opts.enabled:
        return

    # Check the module's main .sip file exists.
    if os.access(os.path.join(src_dir, "sip", mname, mname + "mod.sip"), os.F_OK):
        sipconfig.inform("Checking to see if the %s module should be built..." % mname)

        if check_api(incfile, test, mname, extra_include_dirs=extra_include_dirs, extra_lib_dirs=extra_lib_dirs, extra_libs=extra_libs):
            pyqt_modules.append(mname)

不管那么多了,直接增加一句

        if mname=="QtHelp":
            pyqt_modules.append(mname)

然后重新安装PyQt4,运行

Python configure.py

发现QtHelp编程需要安装的组件了,MakeFile里面也有了,接下来运行

make

make install

结果又来错误了:

cp -f /root/download/PyQt-x11-gpl-4.10.1/sip/QtHelp/qhelpenginecore.sip /usr/local/share/sip/PyQt4/QtHelp/qhelpenginecore.sip
cp: 无法创建普通文件"/usr/local/share/sip/PyQt4/QtHelp/qhelpenginecore.sip": 没有那个文件或目录
make[1]: *** [install] 错误 1
make[1]: Leaving directory `/root/download/PyQt-x11-gpl-4.10.1/QtHelp'
make: *** [install] 错误 2
不管了,直接手动创建/usr/local/share/sip/PyQt4/QtHelp文件夹,然后把/root/download/PyQt-x11-gpl-4.10.1/sip/QtHelp/qhelpenginecore.sip copy到/usr/local/share/sip/PyQt4/QtHelp/qhelpenginecore.sip。

最后再安装eric4,总算安装成功了。

Python Version: 2.7.3
Found PyQt4
Found QtHelp
Found QScintilla2
Qt Version: 5.0.2
PyQt Version:  4.10.1
QScintilla Version:  2.7.1
All dependencies ok.
Cleaning up old installation ...

Creating configuration file ...

Compiling user interface files ...

Compiling source files ...

Installing eric4 ...

Installation complete.




你可能感兴趣的:(eric,eric)