CentOS 安裝mod_python

來源:互聯網
上載者:User

1.初始環境安裝
httpd相關的RPM包版本號碼:
httpd-2.2.3-63.el5.centos.1
httpd-devel-2.2.3-63.el5.centos.1
apr-1.2.7-11.el5_3.1
apr-devel-1.2.7-11.el5_3.1
apr-util-1.2.7-11.el5
apr-util-devel-1.2.7-11.el5

2.編譯python 2.7
./configure -enable-shared
wget http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
tar jfvx Python-2.7.tar.bz2
cd Python-2.7
./configure -enable-shared
make all
make install
make clean
make distclean

----------------------------------------
預設有裝python 2.4,進行以下操作
mv /usr/bin/python /usr/bin/python-bak
ln -s /usr/local/bin/python2.7 /usr/bin/python
sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/python2.4/g' /usr/bin/yum
------------------------------------------

安裝完成後,執行python應該不成功,錯誤資訊為:

/usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

解決方案:
vim /etc/ld.so.conf
加入新的一行:
/usr/local/lib

然後執行:
/sbin/ldconfig
/sbin/ldconfig -v

3.安裝mod_python-3.3.1
第一步:./configure --with-apxs=/usr/sbin/apxs

第二步:
vi src/connobject.c
修改
!(b == APR_BRIGADE_SENTINEL(b) ||

!(b == APR_BRIGADE_SENTINEL(bb) ||

第三步:
make

第四步:
make install

安裝完成後在目錄 /usr/lib64/httpd/modules
查看是否存在
mod_python.so

參考:
http://stackoverflow.com/questions/7880454/python-executable-not-finding-libpython-shared-library
http://hi.baidu.com/iwater707/item/34b71827e08487150975081d
http://bbs.chinaunix.net/thread-1198737-1-1.html
http://linux.chinaitlab.com/set/852148.html
http://www.360doc.com/content/12/0322/18/6938655_196712249.shtml

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.