首先感谢xinkai 。https://github.com/Xinkai/XwareDesktop

1、Ubuntu 12.04.1 先搭建 Python3.4.2 + Qt5.3.2 + PyQt5.11.3环境

安装路径根据自己情况调整,这里默认安装到  /opt 下

安装Python3.4.2
Python3.4.2 下载:https://www.python.org/downloads/release/python-342/
tar xvf Python-3.4.2.tgz

sudo apt-get install tcl tk tk-dev

 ./configure --prefix=/opt/python --enable-shared --enable-ipv6 --enable-loadable-sqlite-extensions --with-dbmliborder=bdb:gdbm --with-computed-gotos --without-ensurepip --with-system-expat --with-system-libmpdec --with-system-ffi --with-fpectl CC="x86_64-linux-gnu-gcc" CFLAGS="-g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security " LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro" CPPFLAGS="-D_FORTIFY_SOURCE=2"

make

sudo make install

修改链接库路径
sudo gedit /etc/ld.so.conf.d/libc.conf
/usr/local/lib
/opt/python/lib
sudo ldconfig

检查配置
/opt/python/bin/python3.4 -m sysconfig | grep CONFIG_ARGS
CONFIG_ARGS = "'--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-loadable-sqlite-extensions' '--with-dbmliborder=bdb:gdbm' '--with-computed-gotos' '--without-ensurepip' '--with-system-expat' '--with-system-libmpdec' '--with-system-ffi' '--with-fpectl' 'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'"

安装扩展包
/opt/python/lib/python3.4/site-packages //扩展包安装位置
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz
tar xvf setuptools-7.0.tar.gz
sudo /opt/python/bin/python3.4 setup.py install

wget http://pypi.python.org/packages/source/p/pip/pip-1.5.6.tar.gz
tar xvf pip-1.5.6.tar.gz
sudo /opt/python/bin/python3.4 setup.py install

wget http://github.com//seb-m/pyinotify/archive/master.zip
unzip -x master.zip -d pyinotify
sudo /opt/python/bin/python3.4 setup.py install

检查模块是否正常工作
/opt/python/bin/python3.4
检查 from tkinter import *
检查 import pyinotify

安装Qt5
Ubuntu 12.04.1 自带Qt4的部分库文件,但是我们的平台要求Qt5,所以首先安装Qt5.
Qt5.3.2下载:http://qt-project.org/downloads
安装过程:
下载到的是Qt5的在线安装程序,为其赋予可执行权限即可单击启动。由于我之前文件都安装在/opt目录下,故这里以root身份安装:

chmod a+x qt-opensource-linux-x64-5.3.2.run

sudo ./qt-opensource-linux-x64-5.3.2.run

安装路径:
/opt/Qt

链接库路径
sudo gedit /etc/ld.so.conf.d/libc.conf
/usr/local/lib

/opt/python/lib
/opt/Qt/5.3/gcc_64/lib
sudo ldconfig

安装SIP 4.16.4。
SIP 4.16.4下载:http://www.riverbankcomputing.com/software/sip/download
安装过程:
tar xvf sip-4.16.4.tar.gz

/opt/python/bin/python3.4  configure.py 

make

sudo make install

配置过程:
SIP无需配置,只是需要安装完成后注意核对一下版本:
分别在终端输入:
/opt/python/bin/sip -V  
在python3环境输入:
/opt/python/bin/python3.4
>>> import sip  
>>> print(sip.SIP_VERSION_STR)
>>> exit()

安装PyQt5
PyQt是Python的一个跨平台图形开发工具集,是Python与Qt的成功融合。PyQt包含了大约440个类、超过6000个的函数和方法,灰常 强大。需要注意的是,Eric(一种Python IDE,依赖PyQt)当前最新的稳定版Eric5只支持PyQt4(确切的说是PyQt4.8以上5.0以下),支持PyQt5的Eric版本现在仅为 Eric6.0 snapshot版,该版本包含最新的Eric5的所有功能,但稳定性需要测试。如果你希望使用稳定的Eric5,请在此步骤安装PyQt4的最新版 PyQt4.11.2。这里我们安装PyQt5.3.2.
PyQt5.3.2下载:http://www.riverbankcomputing.com/software/pyqt/download5
安装过程:
tar xvf PyQt-gpl-5.3.2.tar.gz
/opt/python/bin/python3.4 configure.py

gedit QtWebKitWidgets/QtWebKitWidgets.pro
QT += printsupport


错误处理:
strip:/usr/bin/pyuic5: 不可识别的文件格式
make: [install_pyuic5] 错误 1 (忽略)


gedit Makefile
#    -strip $(INSTALL_ROOT)/usr/bin/pyuic5
接下来执行编译安装:
make

sudo make install

配置过程:
安装完成后进入Python3环境验证是否安装成功:
/opt/python/bin/python3.4
>>> from PyQt5.QtCore import PYQT_VERSION_STR
>>> print("PyQt Version: ", PYQT_VERSION_STR)
>>> exit()


2、安装原生迅雷

下载去掉版本控制的deb文件:见附件

安装依赖包

sudo apt-get install lib32z1 libc6 libc6-i386 libgcc1 libstdc++6  libcap2-bin chrpath zlib1g:i386 libc6:i386

安装 原生迅雷:sudo dpkg -i xware-desktop_ubuntu-12.04.1.deb

修改原生迅雷的py文件的运行环境(注意前面的环境搭建时的路径这里默认/opt/python/bin/python3.4)

sudo gedit xware-desktop/frontend/launcher.py
sudo gedit xware-desktop/frontend/libxware/daemon.py
sudo gedit xware-desktop/frontend/CrashReport/CrashReportApp.py
sudo gedit xware-desktop/frontend/morula.py
sudo gedit xware-desktop/daemon/xwared.py

将 #!/usr/bin/python3修改 #!/opt/python/bin/python3.4