fedora23安装robotframework和ride-错误篇

环境:fedora 23 x86_64

1. 使用 python 2.7 时安装 ride 的错误

直接用命令装的 ride,装的是 ride 1.5.2.1。安装没问题,但是运行 ride.py 的时候会提示 wxPython 版本的问题。

使用 dnf 默认装的 wxPython x86_64 3.0.2.0-8.fc23 会提示不能用,打不开 ride.py。并提示下面的链接

https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/,我现在所使用的 http://git.oschina.net/danacai/wxwidgets2-8-2-8-12-1

fedora 源里 最接近的 rpm 包 wxPython-2.8.12.0-8.fc21.x86_64.rpm 可以使用 dnf 正常安装,ride.py 可以打开,但是也是提示兼容性问题,让使用上面的链接,只能用上面的链接从源码安装了。

1.1 安装 wxwidgets2.8-2.8.12.1 时的错误

1.1.1 gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1:

需要安装 sudo dnf install redhat-rpm-config

ref: https://bugs.launchpad.net/openstack-gate/+bug/1424582

1.1.2 src/helpers.cpp:15:20: fatal error: Python.h: No such file or directory

需要安装 python-devel

ref: http://weerapurage.org/blog/2013/11/12/compile-wxpython-2-dot-9-5-dot-0-in-linux/

1.2 在 wxPython 目录 里使用 python setup.py install 安装 wxPython 时:

1.2.1 /wxPython_int.h:19:19: wx/wx.h: No such file or directory

需要配置 LD_LIBRARY_PATH 将当前用户和root用户都配置一下,或者在全局配置。默认wxwidgets2.8-2.8.12.1 的这个源码时装载 /usr/local/lib里的,因此要在LD_LIBRARY_PATH 里加上这个路径, 

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib
export LD_LIBRARY_PATH

1.2.2 fatal error: wx/stc/stc.h: No such file or directory

在 contrib 目录下运行,加载 contrib 模块,并的 configure 时 加载  --with-gtk --enable-gtk2 --enable-unicode

     ./configure --with-gtk --enable-gtk2 --enable-unicode
     make
     sudo make install

     # Install wxWidgets contrib modules.
     cd contrib/
     make
     sudo make install

ref: http://forum.tinycorelinux.net/index.php?topic=16717.0

1.2.3 format not a string literal and no format arguments [-Wformat-security]

PyErr_Format(PyExc_RuntimeError, mesg);

通过 

grep -R "PyErr_Format(PyExc_RuntimeError, mesg);" ./

可以看到源码中有很多文件有这个问题

进入相应目录通过

sed -i 's/PyErr_Format(PyExc_RuntimeError, mesg);/PyErr_Format(PyExc_RuntimeError, "%s", mesg);/g' *.cpp

进行批量替换为 PyErr_Format(PyExc_RuntimeError,  "%s", mesg);

ref: http://stackoverflow.com/questions/26598085/format-not-a-string-literal-and-no-format-arguments-wformat-security

https://www.cyberciti.biz/faq/unix-linux-replace-string-words-in-many-files/

1.2.4 error: 'wxGLCanvas' was not declared in this scope

尝试在 configure wxwidgets2.8-2.8.12.1 的时候 打开 opengl 支持,或者 使用 python setup.py install BUILD_GLCANVAS=0 禁用它,我这里使用的后者。

ref: http://wxpython-users.1045709.n5.nabble.com/Source-Compilation-errors-td2369170.html

2. 最初使用 python 3.4 时的错误

默认使用 pip install 安装的 robotframework-selenium2library 不支持 python 3.x,所以 使用

pip install -U https://github.com/HelioGuilherme66/robotframework-selenium2library/archive/v1.8.0b3.tar.gz

安装了 beta 版,但是后面装 ride 的时候还是会有问题,如: NameError: name 'execfile' is not defined

ref: https://github.com/robotframework/Selenium2Library/issues/573
https://github.com/HelioGuilherme66/robotframework-selenium2library/tree/v1.8.0b3
https://github.com/robotframework/RIDE/issues/1587

最终还是切换回了 python 2.7 的安装环境

 

posted @ 2017-04-08 19:52  cabbage112  阅读(1532)  评论(0编辑  收藏  举报