zoukankan      html  css  js  c++  java
  • Installing Python 2.7.2 on Centos 5.2

    Installing Python 2.7.2 on Centos 5.2 - Junk Food for the Brain


    Installing Python 2.7.2 on Centos 5.2

     

    Jan 28th, 2012

    | Comments

    Centos / RHEL5 come with Python v2.4.3, which was relased in 2006 and is as ancient as you can get nowdays. Even other application build scripts require Python >= 2.5 for building, e.g node.js & Spidermonkey 1.8.5. :|

    This is my attempt at building a base Python distro that sits in /opt/python-2.7.2. My goal is to minimize depending on the installed system developement libraries; As in Enterprise-y environments, ‘polluting’ the standard OS image will result in a visit from the XKCD GOTO Raptor.

    tldr; This is the script I created to install Python.

    To start, I installed Centos 5.2 with only the groups @core, @base and @development tools. A few Text-Based Internet utilities were also installed for convinience’s sake.

    I then downloaded Python 2.7.2 and ran the standard configure-make-make install routine, and got this:

    INFO: Can't locate Tcl/Tk libs and/or headers
    
    …Snipped...
    Python build finished, but the necessary bits to build these modules were not found:
    _bsddb             _curses            _curses_panel
    _sqlite3           _ssl               _tkinter
    bsddb185           bz2                dbm
    dl                 gdbm               imageop
    readline           sunaudiodev        zlib
    To find the necessary bits, look in setup.py in detect_modules() for the module's name.
    ….Snip…
    

    FML, I knew this was the beginning of a journey into a rabbit hole.

    This is the install sequence

    sqlite
    bzip2
    zlib
    openssl
    ncurses
    readline
    gdbm
    bsddb
    python
    

    Some decisions I took:

    Not installing the TCL/TK toolkit, as building tk requires X11 libraries which I didn’t install.

    The end result was this:

    Building dbm using bdb
    INFO: Can't locate Tcl/Tk libs and/or headers
    
    Python build finished, but the necessary bits to build these modules were not found:
    _tkinter           bsddb185           dl
    imageop            sunaudiodev
    To find the necessary bits, look in setup.py in detect_modules() for the module's name.
    

    sunaudiodev is is for Sun platforms,dl for 32bit platforms, imageop is deprecated and bsddb185 is undocumented.

    What the script does:

    * created a directory called src and build.

    * Downloads the required libraries and compiles them in build
    * installs them all in /opt/python-2.7.2
    * Removing this should be as easy as rm -rf /opt/python-2.7.2

    If you wish to modify the install path, edit the PREFIX option in the script.

    References:
    * andrew.io
    * Equatorian

    Similar Projects that Address this issue (more elegantly)
    * pythonbrew
    * pybuild

  • 相关阅读:
    Activiti系列——如何在eclipse中安装 Activiti Designer插件
    C语言 二维数组与指针笔记
    Ubuntu linux设置从当前目录下加载动态库so文件
    Ubuntu14.04安装nfs服务器
    Ubuntu14.04 搭建FTP服务器
    Linux备忘命令
    Java实现对xml文件的增删改查
    Java利用jacob实现打印Excel文件
    git操作列表
    swiper 窗口宽度变化,页面宽度高度变化 导致自动滑动 解决方案
  • 原文地址:https://www.cnblogs.com/lexus/p/2368022.html
Copyright © 2011-2022 走看看