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

相关文章

gitlab安装及邮箱配置和常用使用方式

《gitlab安装及邮箱配置和常用使用方式》:本文主要介绍gitlab安装及邮箱配置和常用使用方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1.安装GitLab2.配置GitLab邮件服务3.GitLab的账号注册邮箱验证及其分组4.gitlab分支和标签的

MySQL MCP 服务器安装配置最佳实践

《MySQLMCP服务器安装配置最佳实践》本文介绍MySQLMCP服务器的安装配置方法,本文结合实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下... 目录mysql MCP 服务器安装配置指南简介功能特点安装方法数据库配置使用MCP Inspector进行调试开发指

在Windows上使用qemu安装ubuntu24.04服务器的详细指南

《在Windows上使用qemu安装ubuntu24.04服务器的详细指南》本文介绍了在Windows上使用QEMU安装Ubuntu24.04的全流程:安装QEMU、准备ISO镜像、创建虚拟磁盘、配置... 目录1. 安装QEMU环境2. 准备Ubuntu 24.04镜像3. 启动QEMU安装Ubuntu4

Python UV安装、升级、卸载详细步骤记录

《PythonUV安装、升级、卸载详细步骤记录》:本文主要介绍PythonUV安装、升级、卸载的详细步骤,uv是Astral推出的下一代Python包与项目管理器,主打单一可执行文件、极致性能... 目录安装检查升级设置自动补全卸载UV 命令总结 官方文档详见:https://docs.astral.sh/

Nexus安装和启动的实现教程

《Nexus安装和启动的实现教程》:本文主要介绍Nexus安装和启动的实现教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、Nexus下载二、Nexus安装和启动三、关闭Nexus总结一、Nexus下载官方下载链接:DownloadWindows系统根

Java SWT库详解与安装指南(最新推荐)

《JavaSWT库详解与安装指南(最新推荐)》:本文主要介绍JavaSWT库详解与安装指南,在本章中,我们介绍了如何下载、安装SWTJAR包,并详述了在Eclipse以及命令行环境中配置Java... 目录1. Java SWT类库概述2. SWT与AWT和Swing的区别2.1 历史背景与设计理念2.1.

安装centos8设置基础软件仓库时出错的解决方案

《安装centos8设置基础软件仓库时出错的解决方案》:本文主要介绍安装centos8设置基础软件仓库时出错的解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录安装Centos8设置基础软件仓库时出错版本 8版本 8.2.200android4版本 javas

Pytorch介绍与安装过程

《Pytorch介绍与安装过程》PyTorch因其直观的设计、卓越的灵活性以及强大的动态计算图功能,迅速在学术界和工业界获得了广泛认可,成为当前深度学习研究和开发的主流工具之一,本文给大家介绍Pyto... 目录1、Pytorch介绍1.1、核心理念1.2、核心组件与功能1.3、适用场景与优势总结1.4、优

conda安装GPU版pytorch默认却是cpu版本

《conda安装GPU版pytorch默认却是cpu版本》本文主要介绍了遇到Conda安装PyTorchGPU版本却默认安装CPU的问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的... 目录一、问题描述二、网上解决方案罗列【此节为反面方案罗列!!!】三、发现的根本原因[独家]3.1 p

windows系统上如何进行maven安装和配置方式

《windows系统上如何进行maven安装和配置方式》:本文主要介绍windows系统上如何进行maven安装和配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不... 目录1. Maven 简介2. maven的下载与安装2.1 下载 Maven2.2 Maven安装2.