python mod,mod_python的安装
发布日期:2021-06-24 10:48:39 浏览次数:4 分类:技术文章

本文共 1473 字,大约阅读时间需要 4 分钟。

版本要求:

python Python-2.5.4.tgz   (关于这一步,有好多linux环境下已经有python啦,可以不用安装, 一般python在/usr/bin这个目录下)

mod_python mod_python-3.3.1

apache

2. mod_python 的源文件要做修改,不然编译不过  (这个是一定要改的)

src/connobject.c 的 142 行,改成

//!(b == APR_BRIGADE_SENTINEL(b) ||

!(b == APR_BRIGADE_SENTINEL(bb) ||

3. 开始编译

./configure --with-apxs=/www/apache2/bin/apxs --with-python=/usr/bin/python

make

make install

编辑httpd.conf

Alias /liuy  "/home/liuy/public_html"

Options FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

#        SetHandler mod_python

AddHandler mod_python .py

PythonHandler mod_python.publisher

PythonDebug On

测试:

在/home/liuy/public_html 目录下新建一个test.py

#coding:gb2312

def index(req):

req.write("hello,world!")

return

在x86-64下的安装:

安装python2.5(不影响原来python2.4.3)

# tar -xvfz Python-2.5.tgz

# cd Python-2.5

配置Python安装参数,不影响系统原有2.4.3环境

安装目录/opt/python2.5 启用线程 启用共享

# ./configure --prefix=/opt/python2.5 --with-threads --enable-shared

# make

# make install

创建别名

# vi /root/.bash_profile

在最后一行添加

alias python='/opt/python2.5/bin/python'

# source /root/.bash_profile

添加/usr/bin/python2.5符号连接

# ln -s /opt/python2.5/bin/python /usr/bin/python2.5

配置ld查找python2.5动态库

# vi /etc/ld.so.conf.d/opt-python2.5.conf

添加/opt/python2.5/lib后保存

/opt/python2.5/lib

更新动态库目录

# ldconfig

将python2.5动态库copy到/usr/lib

# cp /opt/python2.5/lib/libpython2.5* /usr/lib

# tar -xvzf mod_python-3.3.1.tgz

# cd mod_python-3.3.1

# ./configure --with-apxs=/usr/sbin/apxs --with-python=/opt/python2.5/bin/python

# make

# make install

转载地址:https://blog.csdn.net/weixin_32290249/article/details/116164179 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:python分析彩票数据,这波太炸了!Python脚本可视化居然可以这么玩
下一篇:osx php7 memcached,mac下如何进行php7.1 memcache扩展的安装

发表评论

最新留言

表示我来过!
[***.240.166.169]2024年04月23日 21时05分51秒