leo 的安装

2024-01-21 13:59
文章标签 安装 leo

本文主要是介绍leo 的安装,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

下载leo

-rw-r--r--.  1 root root   7282503 Sep 17  2014 Leo-4.11-final.zip

解压

[root@centosTest download]# unzip Leo-4.11-final.zip 

进入Leo然后看安装需求

[root@centosTest Leo-4.11-final]# more INSTALL.TXT 

@language rest
System requirements
-------------------


Leo requires the `Python`_ and `PyQt_` package.
The `PyEnchant`_ package is optional.

可以看到首先需要安装python和pyqt

如果你对这个有了解的话你会知道需要安装pyqt,你得首先安装好qt及sip

下载安装Pyqt4及sip:

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


安装QT,
下载地址: http://origin.releases.qt-project.org/qt4/source/qt-everywhere-

如果没有安装qt就安装pyqt的话,会报如下类似错误:

[root@cognoswithdb2 PyQt-x11-gpl-4.11.2]#python configure.py

Error: Make sure you have a working Qtqmake on your PATH or use the -q

argument to explicitly specify a working Qtqmake.

有时候安装了qt还是会好上述错误的话,你可以制定qmake路径,如下

[root@cognoswithdb2 PyQt-x11-gpl-4.11.2]# python configure.py -q /usr/bin/qmake-qt4
Determining the layout of your Qt installation...
Error: Qt has been built as static libraries so either the -g or -k argument
should be used.
[root@cognoswithdb2 PyQt-x11-gpl-4.11.2]# python configure.py -q /usr/bin/qmake-qt4 -g
Determining the layout of your Qt installation...
This is the GPL version of PyQt 4.11.2 (licensed under the GNU General Public
License) for Python 2.7.3 on linux2.Type '2' to view the GPL v2 license.
Type '3' to view the GPL v3 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.

基础环境搭建

yum -y install gcc automake autoconf libtool make
yum install gcc-c++
在安装QT 之前,还有可能要执行如下的命令,安装需要的依赖包
yum install libX*

安装python2.7

见我的博客 http://blog.csdn.net/fuwencaho/article/details/39452129

--20140923号修订:
安装好之后记得编辑下默认python,否则可能之后会有意想不到的错误,python2.6报错很奇怪
cd /usr/bin
rm -rf python
ln -s /usr/local/bin/python2.7 python
这样做了之后,可能导致一个问题yum 命令不能用,这时需要修改yum
vi /usr/bin/yum
修改第一行的python路径 #!/usr/bin/python2.6因为centos 是用的python2.6


好吧,言归正传,安装sip

下载;

-rw-r--r--.  1 root root    745329 Sep 18  2014 sip-4.14.1.tar.gz

解压;

[root@centosTest sip-4.14.1]# tar -zxvf sip-4.14.1.tar.gz 

[root@centosTest sip-4.14.1]# cd sip-4.14.1

编译:

[root@centosTest sip-4.14.1]# make
make[1]: Entering directory `/root/python_file/download/sip-4.14.1/sipgen'
gcc -c -pipe -O2 -w -DNDEBUG -I. -o main.o main.c
gcc -c -pipe -O2 -w -DNDEBUG -I. -o transform.o transform.c
gcc -c -pipe -O2 -w -DNDEBUG -I. -o gencode.o gencode.c
gcc -c -pipe -O2 -w -DNDEBUG -I. -o extracts.o extracts.c
gcc -c -pipe -O2 -w -DNDEBUG -I. -o export.o export.c
gcc -c -pipe -O2 -w -DNDEBUG -I. -o heap.o heap.c
gcc -c -pipe -O2 -w -DNDEBUG -I. -o parser.o parser.c
gcc -c -pipe -O2 -w -DNDEBUG -I. -o lexer.o lexer.c
g++  -o sip main.o transform.o gencode.o extracts.o export.o heap.o parser.o lexer.o 
make[1]: Leaving directory `/root/python_file/download/sip-4.14.1/sipgen'
make[1]: Entering directory `/root/python_file/download/sip-4.14.1/siplib'
gcc -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/local/include/python2.7 -o siplib.o siplib.c
gcc -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/local/include/python2.7 -o apiversions.o apiversions.c
gcc -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/local/include/python2.7 -o descriptors.o descriptors.c
gcc -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/local/include/python2.7 -o qtlib.o qtlib.c
gcc -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/local/include/python2.7 -o threads.o threads.c
gcc -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/local/include/python2.7 -o objmap.o objmap.c
gcc -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/local/include/python2.7 -o voidptr.o voidptr.c
g++ -c -pipe -fPIC -O2 -w -DNDEBUG -I. -I/usr/local/include/python2.7 -o bool.o bool.cpp
g++ -shared -Wl,--version-script=sip.exp -o sip.so siplib.o apiversions.o descriptors.o qtlib.o threads.o objmap.o voidptr.o bool.o 
make[1]: Leaving directory `/root/python_file/download/sip-4.14.1/siplib'
[root@centosTest sip-4.14.1]# 

安装:

[root@centosTest sip-4.14.1]# make install
make[1]: Entering directory `/root/python_file/download/sip-4.14.1/sipgen'
cp -f sip /usr/local/bin/sip
make[1]: Leaving directory `/root/python_file/download/sip-4.14.1/sipgen'
make[1]: Entering directory `/root/python_file/download/sip-4.14.1/siplib'
cp -f sip.so /usr/local/lib/python2.7/site-packages/sip.so
strip /usr/local/lib/python2.7/site-packages/sip.so
cp -f /root/python_file/download/sip-4.14.1/siplib/sip.h /usr/local/include/python2.7/sip.h
make[1]: Leaving directory `/root/python_file/download/sip-4.14.1/siplib'
cp -f sipconfig.py /usr/local/lib/python2.7/site-packages/sipconfig.py
cp -f /root/python_file/download/sip-4.14.1/sipdistutils.py /usr/local/lib/python2.7/site-packages/sipdistutils.py
[root@centosTest sip-4.14.1]# 



----安装sip期间遇到问题

make的时候,报错如下

siplib.c: In function ‘register_exit_notifier’:
siplib.c:12054: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘md’
siplib.c:12054: error: ‘md’ undeclared (first use in this function)
siplib.c:12054: error: expected expression before ‘{’ token
siplib.c:12058: error: ‘PyObject’ undeclared (first use in this function)
siplib.c:12058: error: ‘notifier’ undeclared (first use in this function)
siplib.c:12058: error: ‘atexit_module’ undeclared (first use in this function)
siplib.c:12058: error: ‘register_func’ undeclared (first use in this function)
siplib.c:12058: error: ‘res’ undeclared (first use in this function)
siplib.c: At top level:
siplib.c:12088: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘get_from_convertor’
siplib.c: In function ‘sip_api_enable_autoconversion’:
siplib.c:12126: error: ‘sipPyObject’ has no member named ‘next’
siplib.c:12132: error: ‘PyObject’ undeclared (first use in this function)
siplib.c:12132: error: expected expression before ‘)’ token
siplib.c:12132: error: ‘const union <anonymous>’ has no member named ‘td_py_type’
siplib.c:12132: error: too many arguments to function ‘addPyObjectToList’
siplib.c: In function ‘autoconversion_disabled’:
siplib.c:12146: error: ‘PyObject’ undeclared (first use in this function)
siplib.c:12146: error: ‘type’ undeclared (first use in this function)
siplib.c:12146: error: expected expression before ‘)’ token
siplib.c:12146: error: ‘const union <anonymous>’ has no member named ‘td_py_type’
siplib.c:12149: error: ‘sipPyObject’ has no member named ‘next’
siplib.c:12150: error: ‘sipPyObject’ has no member named ‘object’
siplib.c: At top level:
siplib.c:12160: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
siplib.c:12199: error: expected ‘)’ before ‘*’ token
siplib.c: In function ‘deref_mixin’:
siplib.c:12219: error: ‘sipSimpleWrapper’ has no member named ‘mixin_main’
siplib.c:12219: error: ‘sipSimpleWrapper’ has no member named ‘mixin_main’
siplib.c: At top level:
siplib.c:12226: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
make[1]: *** [siplib.o] Error 1
make: *** [all] Error 2

就这样一直往后上都看不到头了,总是找不到原因,

Google找make[1]: *** [siplib.o] Error 1

make: *** [all] Error 2半天也没找到解决方法,什么ldconfig呀等等都不行,看来没找对方法用什么浏览器都没用呀!唉,没办法,把错误重定向到文件然后再看

[root@cognoswithdb2 downpython]# more haha.err 
siplib.c:20:20: error: Python.h: No such file or directory
In file included from siplib.c:28:
sip.h:50:2: error: #error "This version of SIP requires Python v2.3 or later"
In file included from siplib.c:28:
sip.h:357: error: expected declaration specifiers or ‘...’ before ‘PyObject’
sip.h:358: error: expected declaration specifiers or ‘...’ before ‘PyObject’
sip.h:358: error: expected declaration specifiers or ‘...’ before ‘PyObject’
sip.h:358: error: expected declaration specifiers or ‘...’ before ‘PyObject’
sip.h:358: error: expected declaration specifiers or ‘...’ before ‘PyObject’
sip.h:359: error: expected ‘)’ before ‘*’ token
sip.h:361: error: expected declaration specifiers or ‘...’ before ‘visitproc’
sip.h:367: error: expected ‘)’ before ‘*’ token
sip.h:368: error: expected ‘)’ before ‘*’ token
sip.h:373: error: expected ‘)’ before ‘*’ token
sip.h:374: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
sip.h:378: error: expected declaration specifiers or ‘...’ before ‘PyObject’

呵呵。应该定位到问题了
网上找到解决方法试下http://blog.csdn.net/tianxiajianling/article/details/6636204
[root@cognoswithdb2 sip-4.16.3]# yum install python-devel
果然安装成功了

安装qt:

下载

-rw-r--r--.  1 root     root  233635127 Sep 18  2014 qt-everywhere-opensource-src-4.8.3.tar.gz

解压安装

./configura   (约十分钟)

Qt is now configured for building. Just run 'gmake'.
Once everything is built, you must run 'gmake install'.
Qt will be installed into /usr/local/Trolltech/Qt-4.8.3To reconfigure, run 'gmake confclean' and 'configure'.

编译及安装

make  ----意想不到的竟然花了7个小时

make install   -----十分钟左右


安装pyqt4

-rw-r--r--.  1 root     root   11120742 Sep 17 23:47 PyQt-x11-gpl-4.11.2.tar.gz
解压编译,编译的时候说我的sip版本太低,下在最新版重新安装
-rw-r--r--.  1 root     root     794305 Sep 18 01:04 sip-4.16.3.tar.gz
安装完成之后安装pyqt4
编译的时候报错
python configure.py
Creating pylupdate4 Makefile...
Creating pyrcc4 Makefile...
The Qt Designer plugin was disabled because a dynamic Python library couldn't
be found
Creating pyqtconfig.py...
[root@centosTest PyQt-x11-gpl-4.11.2]# 

不是很明白,好像是缺少python库,安装试试看

[root@cognoswithdb2 sip-4.16.3]# yuminstall python-devel



然后make,但是又出错了
报错如下
make[2]: Entering directory `/root/python_file/download/PyQt-x11-gpl-4.11.2/qpy/QtDeclarative'
/usr/local/Trolltech/Qt-4.8.3/bin/qmake -o Makefile w_qpydeclarative.pro
make[2]: Leaving directory `/root/python_file/download/PyQt-x11-gpl-4.11.2/qpy/QtDeclarative'
make[2]: Entering directory `/root/python_file/download/PyQt-x11-gpl-4.11.2/qpy/QtDeclarative'
/usr/local/Trolltech/Qt-4.8.3/bin/qmake -o Makefile w_qpydeclarative.pro
make[2]: Leaving directory `/root/python_file/download/PyQt-x11-gpl-4.11.2/qpy/QtDeclarative'
make[2]: Entering directory `/root/python_file/download/PyQt-x11-gpl-4.11.2/qpy/QtDeclarative'
/usr/local/Trolltech/Qt-4.8.3/bin/qmake -o Makefile w_qpydeclarative.pro
make[2]: Leaving directory `/root/python_file/download/PyQt-x11-gpl-4.11.2/qpy/QtDeclarative'
make[2]: Entering directory `/root/python_file/download/PyQt-x11-gpl-4.11.2/qpy/QtDeclarative'
/usr/local/Trolltech/Qt-4.8.3/bin/qmake -o Makefile w_qpydeclarative.pro
Warning: File `qpydeclarative.pro' has modification time 1.8e+06 s in the future

而且是一直循环报这个错,google下说是时间不同步,调整下虚拟机时间
[root@centosTest PyQt-x11-gpl-4.11.2]# date -s "2014-09-22 19:47"

重新make成功(小插曲:make的时候说 ImportError: No module named sipconfig ,重新安装下sip解决)
然后
make install | tee makeinstall.log
成功

测试pyqt安装完成
测试脚本testgui.py
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()
widget.resize(250, 150)
widget.setWindowTitle('yihaomen.com QT TEST')
widget.show()
sys.exit(app.exec_())

python testgui,py 会生成一个窗口,则成功


现在安装leo

[root@centosTest Leo-4.11-final]# python launchLeo.py 
launchLeo.py: cannot connect to X server 
[root@centosTest Leo-4.11-final]# 
我是在securet CRT中运行,无法启动x windows。到虚拟机中去启动
发现闪退现象,然后报错如下
  File "/root/python_file/download/Leo-4.11-final/leo/plugins/qtGui.py", line 705, in setSelectionRangei,j = self.toGuiIndex(i),self.toGuiIndex(j)File "/root/python_file/download/Leo-4.11-final/leo/plugins/qtGui.py", line 635, in toPythonIndexs = self.getAllText()File "/root/python_file/download/Leo-4.11-final/leo/plugins/qtGui.py", line 897, in getAllTextreturn g.u(s)File "/root/python_file/download/Leo-4.11-final/leo/core/leoGlobals.py", line 4659, in ureturn unicode(s)
TypeError: 'sip.methoddescriptor' object is not callable

找了半天不知道什么原因,也没找到这方面的资料
看官方文档:
install:http://leoeditor.com/installing.html#installing-from-sources-linux
run:http://leoeditor.com/running.html
也没发现哪里做错了,为了确保万一,还安装了 PyEnchant,但是还是不行,都快要疯了,为了安装这个,将近花了一周的空余时间,竟然还是装不起,没办法,最好随便试试了
仔细看官方文档,发现可以在解释器下也可以执行
python
>>>
import leo
leo.run() # runs Leo, opening a new outline or,
leo.run(fileName=aFileName) # runs Leo, opening the given file name.

发现不闪退了,界面是出来了,但是确实功能不全的界面,啥选项都没有!!!怎么办??为什么,,究竟是咋了???都快要放弃了

然后看到还有install,为什么我看到有些解压后直接运行python launchLeo.py,不管了,死马当活马医
#############官网如下
  1. cd ~/leo-4-11-final # Change version as appropriate.
    chmod u+x install
    sudo ./install

The install script will instruct you to add /usr/local/bin to your path. You can, instead, add the following link:

sudo ln -s /usr/local/lib/leo/ /usr/local/lib/python2.6/site-packages/

That’s it! See Running Leo for how to run Leo after installing it.

############哪里来的install文件呀,根本没有吗
倒是看到了
-rw-r--r--.  1 root root   6165 Nov  6  2013 setup.py
python setup.py --help
看到安装命令是这样
python setup.py install
安装之后运行python launchLeo.py
还是跟没安装之前一样,包括在解释器中执行!

怎么办,在进unzip后的源码
more INSTALL.TXT
看到这样一句话
If the sources are zipped, unpack them
into a temp folder. You may place the sources anywhere you like, including
Python's *site-packages* folder, for example,
C:\Python26\Lib\site-packages.

 find / -name site-packages -type d
找到2.7的,把leo放到该目录下安装运行,还是一样

仔细看之前的pyqt的编译安装,发现他好像使用的是python2.6.而不是2.7.记得当时我安装2.7环境的时候不是把2.6的给覆盖掉了吗(见python安装部分,怎么还是没覆盖以前的样子)
没办法,重新覆盖一遍:
cp /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/bin/python2.7 python

好,重新执行
[root@centosTest Leo-4.11-final]# pwd
/root/python_file/download/Leo-4.11-final
[root@centosTest Leo-4.11-final]# python launchLeo.py 


报什么_sqlite3 模块未找到

很奇怪的错误,为什么之前2.6环境的时候没有报这个错,find 一下这个文件,发现之后2.6路径下有一个_sqlite2.so文件有点像

[root@centosTest Leo-4.11-final]# python launchLeo.py ^C
[root@centosTest Leo-4.11-final]# find / -name _sqlite3* -type f
/root/python_file/download/Python-2.7.3/PC/VC6/_sqlite3.dsp
/root/python_file/download/Python-2.7.3/PC/VS8.0/_sqlite3.vcproj
/root/python_file/download/Python-2.7.3/PC/VS7.1/_sqlite3.vcproj
/root/python_file/download/Python-2.7.3/PCbuild/_sqlite3.vcproj
/usr/lib64/python2.6/lib-dynload/_sqlite3.so

好吧,就把你cp到2.7环境下看看吧

cp /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/sqlite3/_sqlite3.so  (目标路径根据报错得出)

重新 python launchLeo.py 

发现报另外的错了,没有pyqt4 模块,这难道还要重新安装一遍pyqt,没办法,反正是死马

重新编译安装sip ,pyqt4(这是python configure.py 的时候,因为python调用的是2.7环境,所以她们也是安装在2.7环境下,我是这样理解的)

好吧,一个小时之后,奇迹发生了




--总结,安装leo,花了将近一周的闲暇时间,平均每天晚上整到近两点(都不好意思说),因为对python的不熟悉,因为QT,PYQT,SIP,python之间的兼容性问题,导致安装期间出现了各种数不清的问题,最后最后关头,差点放弃,骂骂咧咧道,去他粮的,什么文学化编程呀,太难整了!但是还是多试了一遍并且安装成功了,想到成功之前的一刻,太难受了,差点放弃,想到马云的一句话(唉,阿里巴巴刚上市),今天很残酷,明天更残酷,后天很美好,很多人都死在明天晚上,看不到后天的太阳!!觉得特别有道理!无数次的尝试,无数次的失败,可以想见,成功是如何的来时不易,成功不是一蹴而就,在将要成功之时放弃,你可以找很多借口,你会觉得没办法,你会说你已经尽全力了!!!但是你放弃了,前面无数次的努力都是白费的,任何时候都要记得,成功是经过无数次白费的努力坚持下来的!!当你在困难面前放弃了,下次遇到问题,还是一样的结果,最后只会是一事无成!!!当你觉得你坚持不下去了,调整好心态,调整好心情,整理一下失败的经验,重新总结下问题的重点,然后重新面对难题,就当是你第一次碰到她,而在此时,你已经积累了很多宝贵的经验,你已经在一个更高的高度,所以决定最后成败的,不是技术,而是你重新面对问题的勇气!!!还有,在困难面前,你会学到的更多!!(近两点,晚安)

-----待续!!!!!!!!!


这篇关于leo 的安装的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/629773

相关文章

RabbitMQ 延时队列插件安装与使用示例详解(基于 Delayed Message Plugin)

《RabbitMQ延时队列插件安装与使用示例详解(基于DelayedMessagePlugin)》本文详解RabbitMQ通过安装rabbitmq_delayed_message_exchan... 目录 一、什么是 RabbitMQ 延时队列? 二、安装前准备✅ RabbitMQ 环境要求 三、安装延时队

linux系统上安装JDK8全过程

《linux系统上安装JDK8全过程》文章介绍安装JDK的必要性及Linux下JDK8的安装步骤,包括卸载旧版本、下载解压、配置环境变量等,强调开发需JDK,运行可选JRE,现JDK已集成JRE... 目录为什么要安装jdk?1.查看linux系统是否有自带的jdk:2.下载jdk压缩包2.解压3.配置环境

Python库 Django 的简介、安装、用法入门教程

《Python库Django的简介、安装、用法入门教程》Django是Python最流行的Web框架之一,它帮助开发者快速、高效地构建功能强大的Web应用程序,接下来我们将从简介、安装到用法详解,... 目录一、Django 简介 二、Django 的安装教程 1. 创建虚拟环境2. 安装Django三、创

linux安装、更新、卸载anaconda实践

《linux安装、更新、卸载anaconda实践》Anaconda是基于conda的科学计算环境,集成1400+包及依赖,安装需下载脚本、接受协议、设置路径、配置环境变量,更新与卸载通过conda命令... 目录随意找一个目录下载安装脚本检查许可证协议,ENTER就可以安装完毕之后激活anaconda安装更

Jenkins的安装与简单配置过程

《Jenkins的安装与简单配置过程》本文简述Jenkins在CentOS7.3上安装流程,包括Java环境配置、RPM包安装、修改JENKINS_HOME路径及权限、启动服务、插件安装与系统管理设置... 目录www.chinasem.cnJenkins安装访问并配置JenkinsJenkins配置邮件通知

Win10安装Maven与环境变量配置过程

《Win10安装Maven与环境变量配置过程》本文介绍Maven的安装与配置方法,涵盖下载、环境变量设置、本地仓库及镜像配置,指导如何在IDEA中正确配置Maven,适用于Java及其他语言项目的构建... 目录Maven 是什么?一、下载二、安装三、配置环境四、验证测试五、配置本地仓库六、配置国内镜像地址

Python安装Pandas库的两种方法

《Python安装Pandas库的两种方法》本文介绍了三种安装PythonPandas库的方法,通过cmd命令行安装并解决版本冲突,手动下载whl文件安装,更换国内镜像源加速下载,最后建议用pipli... 目录方法一:cmd命令行执行pip install pandas方法二:找到pandas下载库,然后

Linux系统中查询JDK安装目录的几种常用方法

《Linux系统中查询JDK安装目录的几种常用方法》:本文主要介绍Linux系统中查询JDK安装目录的几种常用方法,方法分别是通过update-alternatives、Java命令、环境变量及目... 目录方法 1:通过update-alternatives查询(推荐)方法 2:检查所有已安装的 JDK方

SQL Server安装时候没有中文选项的解决方法

《SQLServer安装时候没有中文选项的解决方法》用户安装SQLServer时界面全英文,无中文选项,通过修改安装设置中的国家或地区为中文中国,重启安装程序后界面恢复中文,解决了问题,对SQLSe... 你是不是在安装SQL Server时候发现安装界面和别人不同,并且无论如何都没有中文选项?这个问题也

2025版mysql8.0.41 winx64 手动安装详细教程

《2025版mysql8.0.41winx64手动安装详细教程》本文指导Windows系统下MySQL安装配置,包含解压、设置环境变量、my.ini配置、初始化密码获取、服务安装与手动启动等步骤,... 目录一、下载安装包二、配置环境变量三、安装配置四、启动 mysql 服务,修改密码一、下载安装包安装地