How to install python, wxPython and ride on CENTOS

0. empty $ROBOTREPO/PACKAGES directory

# rm -rf /repo/root/robot/PACKAGES
# mkdir /repo/root/robot/PACKAGES

 1. Install gcc,g++,gtk2-devel,libSM-devel,gstreamer*

# yum -y install gcc
# yum -y install gcc-c++
# yum install gtk2-devel   
# yum install libSM-devel  
# yum install gstreamer*

//for install python2.7 to support sqlite3
# yum install sqlite-devel   

//for ride error 'robot.libraries.Dialogs' failed: ImportError: No module named tkinter
# yum  install tcl-devel tk-devel tkinter

//for install mercurail
# yum install bzip2 bzip2-devel bzip2-libs

2. Install Python-2.7.11

# tar -xvf Python-2.7.11.tgz 
# cd Python-2.7.11

//for dynamic
# ./configure --prefix=/repo/root/robot/PACKAGES  --enable-shared 

//for static (not success)
# ./configure --disable-shared LDFLAGS="-static -static-libgcc" CPPFLAGS="-static"
# ./configure LDFLAGS="-static -static-libgcc" CPPFLAGS="-static" --prefix=/repo/root/robot/PACKAGES  --enable-shared

//for make and install
#  make && make install

# check if installed successfully
# ls -l /repo/root/robot/PACKAGES/lib/python2.7/lib-dynload/Python-2.7.11-py2.7.egg-info
-rw-r--r-- 1 root root 1525 May 24 02:45 /repo/root/robot/PACKAGES/lib/python2.7/lib-dynload/Python-2.7.11-py2.7.egg-info
//NOTES:
如果后面运行ride过程中,发现python有些module没有安装,可以用yum重新安装此module,然后再编译安装python2.7. 
wxPython,robotframework-3.0和robotframework-ride-1.5.2不需要再重新编译安装。

//例如遇错:ride.py: ImportError: No module named tkinter

//解决方法:
# yum install tkinter
# cd Python-2.7.11
# ./configure --prefix=/repo/root/robot/PACKAGES  --enable-shared 
#  make && make install

3. install wxWidgets-2.8.12

 http://wxwidgets.org/downloads/

# tar -xvf wxWidgets-2.8.12.tar.gz
# cd wxWidgets-2.8.12
# mkdir bld
# cd bld
# ../configure --prefix=/repo/root/robot/PACKAGES/lib/python2.7/site-packages/wx-2.8-gtk2-unicode --with-gtk --with-gnomeprint --with-opengl --enable-debug --enable-geometry --enable-graphics_ctx --enable-sound --with-sdl --enable-mediactrl --enable-display --disable-debugreport --enable-unicode --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=builtin --with-zlib=builtin  

touch .make (编辑.make,写入下面三行)
make $*
make -C contrib/src/gizmos $*
make -C contrib/src/stc $*

# chmod +x .make
# ./.make clean
# ./.make
# ./.make install

4. install wxPython-2.8.12.1 (should install wxWidgets firstly )

# tar -xvf wxPython-src-2.8.12.1.tar.bz2 
# cd wxPython-src-2.8.12.1
# cd wxPython

# /repo/root/robot/PACKAGES/bin/python setup.py build_ext --inplace --debug WX_CONFIG=/repo/root/robot/PACKAGES/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/bin/wx-config BUILD_GLCANVAS=0  

# export ROBOTREPO=/repo/root/robot
# source /repo/root/robot/.robot.profile

# export LD_LIBRARY_PATH=/repo/root/robot/PACKAGES/lib/
# /repo/root/robot/PACKAGES/bin/python2.7 setup.py build
# /repo/root/robot/PACKAGES/bin/python2.7 setup.py install
//NOTES:
UILD_GLCANVAS=0,这个很关键哦,开始出现一大堆编译错误都是因为它。后来看见文档中,

If you get errors about being unable to find libGLU, wxGLCanvas being undeclared, or something similar then you can add BUILD_GLCANVAS=0 to the setup.py command line to disable the building of the glcanvas module.豁然开朗

WX_CONFIG=$opt/wx/2.8/bin/wx-config 中的路径为wxWidgets configure时设置的路径

//check if wxPython has been installed successfully:
# export LD_LIBRARY_PATH=/repo/root/robot/PACKAGES/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/lib

# ls -l /repo/root/robot/PACKAGES/lib/python2.7/site-packages/wxPython_common-2.8.12.1-py2.7.egg-info
-rw-r--r-- 1 root root 1281 May 24 03:27 /repo/root/robot/PACKAGES/lib/python2.7/site-packages/wxPython_common-2.8.12.1-py2.7.egg-info

# /repo/root/robot/PACKAGES/bin/python
>>> import wx
>>> wx.version()
'2.8.12.1 (gtk2-unicode)'

如果执行到这一步,还是报错:
wxPython not found.
You need to install wxPython 2.8.12.1 or 3.0.2 or newer with unicode support to run RIDE. wxPython can be downloaded from http://sourceforge.net/projects/wxpython/files/wxPython/

则检查PYTHONPATH,只用/repo/TEST_PACKAGES或者/repo/atxuser/robot/PACKAGE中的一个,不能两个都写!!

export PYTHONPATH=/repo/TEST_PACKAGES/robot/PACKAGES/lib/python2.7:/repo/TEST_PACKAGES/robot/PACKAGES/lib/python2.7/site-packages

5. install robotframework-3.0

# export LD_LIBRARY_PATH=/repo/root/robot/PACKAGES/lib/
# cd robotframework-3.0
# /repo/root/robot/PACKAGES/bin/python setup.py install --prefix=/repo/root/robot/PACKAGES/

# check if it has been installed successfully
# ls -l /repo/root/robot/PACKAGES//lib/python2.7/site-packages/robotframework-3.0-py2.7.egg-info

 6. install robotframework-ride-1.5.2

# cd robotframework-ride-1.5.2
# /repo/root/robot/PACKAGES/bin/python setup.py install --prefix=/repo/root/robot/PACKAGES/

# check if it has been installed successfully
# ls -l /repo/root/robot/PACKAGES//lib/python2.7/site-packages/robotframework_ride-1.5.2-py2.7.egg-info

7. set correct python path in the following files

//modify the following python path to "/usr/bin/env python"
#!/usr/bin/env python

# grep -r "robot" * | grep repo | grep root
PACKAGES/bin/2to3:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/pydoc:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/python-config:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/img2py:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/pybot:#!/repo/root/robot.up/PACKAGES/bin/python
PACKAGES/bin/python2-config:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/xrced:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/editra:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/smtpd.py:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/pywxrc:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/pyalamode:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/pyshell:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/ride.py:#!/repo/root/robot.up/PACKAGES/bin/python
PACKAGES/bin/python2.7-config:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/idle:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/img2xpm:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/pyalacarte:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/pywrap:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/rebot:#!/repo/root/robot/PACKAGES/bin/python
PACKAGES/bin/img2png:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/helpviewer:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/pycrust:#!/repo/root/robot.up/PACKAGES/bin/python2.7
PACKAGES/bin/robot:#!/repo/root/robot/PACKAGES/bin/python

8. install these python libraries under site-packages directory. 

//install the following python libraries under site-packages directory
//getting the following packages from >>>> https://pypi.python.org/pypi <<<<<


//a sample to install pycrypto-2.6.1
# tar -xvf pycrypto-2.6.1.tar.gz 
# cd pycrypto-2.6.1
# export LD_LIBRARY_PATH=/repo/root/robot/PACKAGES/lib/
# /repo/root/robot/PACKAGES/bin/python setup.py install --prefix=/repo/root/robot/PACKAGES
# ls -l /repo/root/robot/PACKAGES/lib/python2.7/site-packages/Crypto/
# ls -l /repo/root/robot/PACKAGES/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7.egg-info

//another sample to install package
# export ROBOTREPO=/repo/root/robot
# source /repo/root/robot/.robot.profile
# cd package_xxx_xxx
# python setup.py install --prefix=/repo/TEST_PACKAGES/robot/PACKAGES


1 ply-3.6 
  pysmi-0.0.6
  pysnmp-4.3.0
  pyasn1-0.1.9
 
2 numpy-1.9.3

3 ecdsa-0.13
 
4 pycrypto-2.6.1
  paramiko-1.15.2
 
5 Imaging-1.1.7 (get from http://pythonware.com/products/pil/)
 
6 pexpect-3.3 
 
7 simplejson-3.8.0

8 mercurial

9 yum install libxml2 libxml2-devel libxslt libxslt-devel
  lxml-3.5.0

>>>>adding by Ahbijit requirement:
1. alabaster 0.7.9
2. pytz-2016.6.1.tar.gz 
3. Babel-2.3.4.tar.gz
4. pycparser-2.14.tar.gz

5.
yum install libffi-devel 
cffi-1.7.0.tar.gz 

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/lib/libffi-3.0.5/include -I/repo/TEST_PACKAGES/robot/PACKAGES/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-i686-2.7/c/_cffi_backend.o
gcc -pthread -shared build/temp.linux-i686-2.7/c/_cffi_backend.o -L/repo/root/TEST_PACKAGES/robot/PACKAGES/lib -lffi -lpython2.7 -o build/lib.linux-i686-2.7/_cffi_backend.so
/usr/bin/ld: cannot find -lpython2.7
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

>>>>pay attention to wrong path"-L/repo/root/TEST_PACKAGES/robot/PACKAGES/lib", correct it in all configure file. 

grep -r "repo" * | grep root | grep TEST_PACKAGES


6. idna-2.1.tar.gz 
7. enum34-1.1.6.zip 
8. ipaddress-1.0.16.tar.gz (md5)
9. six-1.10.0.tar.gz (md5)
10. cryptography-1.5.tar.gz (md5, pgp)
11. docutils-0.12.tar.gz (md5)
12. futures-3.0.5.tar.gz (md5)
13. imagesize 0.7.1
14. py2-ipaddress 3.4.1
15. MarkupSafe 0.23
16. Jinja2 2.8
17. Logbook 1.0.0
18. ptyprocess 0.5.1
19. py 1.4.31
20. pycrypto 2.6.1
21. Pygments 2.1.3
22. trollius 2.1

23. pyshark 0.3.6.1
>>>modify setup.py
From:
install_requires=['lxml', 'py', 'trollius==1.0.4', 'logbook'],
To: 
install_requires=['lxml', 'py', 'trollius==2.1', 'logbook'],

24. snowballstemmer 1.2.1
25. Sphinx 1.4.6
26. subprocess32 3.2.7
27. wheel 0.29.0
28. yolk 0.4.3
29. pytest 3.0.1
30. requests 2.11.1
31. scapy 2.3.2
32. xmltodict 0.10.2



//cp the following directory from old robot REPO site-packages path 
# cp -r ncclient/ /repo/root/robot.up/PACKAGES/lib/python2.7/site-packages
The following is the result of checking import total 40 required packages:
# python
Python 2.7.11 (default, Jun 28 2016, 10:29:51) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import alabaster 
>>> import pytz
>>> import babel
>>> >>> import pycparser
>>> import cffi
>>> import pyasn1
>>> import idna
>>> from enum import Enum
>>> import ipaddress
>>> >>> import six
>>> import cryptography
>>> >>> import docutils
>>> from concurrent import futures
>>> >>> >>> import imagesize
>>> >>> import ipaddress
>>> from markupsafe import Markup
>>> import jinja2
>>> import logbook
>>> import lxml
>>> import paramiko
>>> import ptyprocess
>>> import pexpect
>>> import ply
>>> import py
>>> from Crypto.Hash import SHA256
>>> import pygments
>>> import trollius
>>> import pyshark
>>> import pysmi
>>> import pysnmp
>>> from robotide import main
>>> import snowballstemmer
>>> import sphinx
>>> import subprocess32
>>> import wheel
>>> import yolk
>>> import pytest
>>> import requests
>>> import scapy
>>> import xmltodict
>>> 

9. copy all lib files *.so.* from old repo PACKAGE/lib directory

cp /repo/root/robot/PACKAGES/lib/libclearlooks.so ./
cp /repo/root/robot/PACKAGES/lib/libcrux-engine.so ./
cp /repo/root/robot/PACKAGES/lib/libexpat.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libglide.so ./
cp /repo/root/robot/PACKAGES/lib/libhcengine.so ./
cp /repo/root/robot/PACKAGES/lib/libindustrial.so ./
cp /repo/root/robot/PACKAGES/lib/libmist.so ./
cp /repo/root/robot/PACKAGES/lib/libmysqlclient_r.so ./
cp /repo/root/robot/PACKAGES/lib/libmysqlclient_r.so.15 ./
cp /repo/root/robot/PACKAGES/lib/libmysqlclient_r.so.15.0.0 ./
cp /repo/root/robot/PACKAGES/lib/libpixmap.so ./
cp /repo/root/robot/PACKAGES/lib/libredmond95.so ./
cp /repo/root/robot/PACKAGES/lib/libsmooth.so ./
cp /repo/root/robot/PACKAGES/lib/libsvg.so ./
cp /repo/root/robot/PACKAGES/lib/libtcl8.5.so ./
cp /repo/root/robot/PACKAGES/lib/libthinice.so ./
cp /repo/root/robot/PACKAGES/lib/libtk8.5.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_base-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_base-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_base-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_base_net-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_base_net-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_base_net-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_baseu-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_baseu-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_baseu_net-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_baseu_net-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_baseu_xml-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_baseu_xml-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_base_xml-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_base_xml-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_base_xml-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_adv-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_adv-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_adv-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_aui-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_aui-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_aui-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_core-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_core-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_core-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_html-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_html-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_html-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_qa-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_qa-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_qa-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_richtext-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_richtext-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_richtext-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_adv-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_adv-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_aui-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_aui-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_core-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_core-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_gizmos-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_gizmos-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_gizmos_xrc-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_gizmos_xrc-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_gl-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_gl-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_html-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_html-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_media-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_media-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_ogl-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_ogl-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_qa-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_qa-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_richtext-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_richtext-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_stc-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_stc-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_svg-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_svg-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_xrc-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2u_xrc-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_xrc-2.8.so ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_xrc-2.8.so.0 ./
cp /repo/root/robot/PACKAGES/lib/libwx_gtk2_xrc-2.8.so.0.8.0 ./
cp /repo/root/robot/PACKAGES/lib/libxml2.so.2 ./
cp /repo/root/robot/PACKAGES/lib/libxml2.so.2.9.3 ./
cp /repo/root/robot/PACKAGES/lib/ ./

10. install glibc under PACKAGES directory

// download from http://ftp.ntu.edu.tw/gnu/glibc/
# tar -xvf glibc-2.14.tar.gz

# mkdir glibc-build
# cd glibc-build

#tar -zxvf ../glibc-linuxthreads-2.7.tar.gz

#tar -zxvf ../glibc-libidn-2.7.tar.gz

#cd ..
#export CFLAGS="-g -O2"
#cd glibc-build
#../configure --prefix=/repo/root/robot/PACKAGES/glibc-2.14 --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin --disable-sanity-checks

#make
#make install

11. remove all pyc and pyo files

//remove all pyc files
# cd /repo/root/robot
# find . -name *.pyc > find_pyc.sh
# sed -i 's/^/rm -rf /g' find_pyc.sh
# chmod 775 find_pyc.sh
# ./find_pyc.sh

//remove all pyo files
# find . -name *.pyo > find_pyo.sh
# sed -i 's/^/rm -rf /g' find_pyo.sh
# chmod 775 find_pyo.sh
# ./find_pyo.sh

//remove shell files
# rm -rf find_pyc.sh 
# rm -rf find_pyo.sh 

 

转载于:https://my.oschina.net/activehealth/blog/678625

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值