zoukankan      html  css  js  c++  java
  • redhat系统6.5,rrdtool命令安装成功但是python无法导入rrdtool

    首先我是yum 安装rrdtool,然后发现:


    [root@redhat174 python-rrdtool-1.4.7]# rrdtool
    RRDtool 1.3.8 Copyright 1997-2009 by Tobias Oetiker <tobi@oetiker.ch>
    Compiled Jan 13 2010 07:01:06

    Usage: rrdtool [options] command command_options

    Valid commands: create, update, updatev, graph, graphv, dump, restore,
    last, lastupdate, first, info, fetch, tune,
    resize, xport

    RRDtool is distributed under the Terms of the GNU General
    Public License Version 2. (www.gnu.org/copyleft/gpl.html)

    For more information read the RRD manpages

    rrdtool命令是可以用的,但是在python里面导入rrdtool模块就不行


    [root@redhat174 soft]# python
    Python 2.6.6 (r266:84292, Sep 4 2013, 07:46:00)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import rrdtool
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "build/bdist.linux-x86_64/egg/rrdtool.py", line 7, in <module>
    File "build/bdist.linux-x86_64/egg/rrdtool.py", line 6, in __bootstrap__
    ImportError: /root/.python-eggs/rrdtool-0.1.11-py2.6-linux-x86_64.egg-tmp/rrdtool.so: undefined symbol: rrd_flushcached
    >>>


    解决方法:

    重新源码安装rrdtool,   ./configure --prefix=/usr/local,make, make install (指定安装目录,以方便接下来引用库文件)

    然后 ln -s /usr/local/lib/librrd* /usr/lib/
    ldconfig

    然后发现:

    [root@redhat174 python-rrdtool-1.4.7]# python
    Python 2.6.6 (r266:84292, Sep 4 2013, 07:46:00)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import rrdtool
    >>>

    python导入rrdtool成功


    其中出现的状况:
    如果在编译的时候出现类似以下错误:
    * I could not find a working copy of libxml-2.0. Check config.log for hints on why
    this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
    so that compiler and the linker can find libxml2 and its header files. If
    you have not installed libxml-2.0, you can get it either from its original home on

    http://xmlsoft.org/downloads.html

    You can find also find an archive copy on

    http://oss.oetiker.ch/rrdtool/pub/libs

    The last tested version of libxml-2.0 is 2.7.8.

    LIBS=-lpcre -lm
    LDFLAGS=
    CPPFLAGS=

    ----------------------------------------------------------------------------

    configure: error: Please fix the library issues listed above and try again.

    解决方法:

    在系统里面 find / -name pkgconfig 查到默认位置在/usr/lib64/pkgconfig,

    然后设置系统变量
    export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$PKG_CONFIG_PATH
    再重装编译


    另外:

    为了编译成功,请提前安装一些库文件:
    yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel pam-devel
    yum install -y rrdtool perl-rrdtool rrdtool-devel

    yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel

    其中rrdtool-devel是系统没有的,wget ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.3/x86_64/os/Packages/rrdtool-devel-1.3.8-6.el6.x86_64.rpm --no-check-certificate
    然后 rpm -ivh rrdtool-devel-1.3.8-6.el6.x86_64.rpm


    不知道同学有没有碰到这问题,这情况困扰我好久,希望能帮到其他 人

  • 相关阅读:
    计算器程序
    输入三个整数,输出最大数和最小数
    输入三个数a,b,c,要示按由小到大的顺序输出
    最短路
    luogu P3953 逛公园
    二分图匹配
    luogu P3231 消毒
    [bzoj2120] [洛谷P1903] 数颜色
    [bzoj2038] [洛谷P1494] [2009国家集训队] 小Z的袜子(hose)
    [洛谷P4012] [网络流24题] 深海机器人问题
  • 原文地址:https://www.cnblogs.com/to-be-rich/p/7250795.html
Copyright © 2011-2022 走看看