mod_python安装、运行报错fatal: Not a git repository (or any of the parent directories): .git

  • 内容
  • 评论
  • 相关

一、环境

环境:Rhel 7.0
Apache 2.4.10
Python  2.7.5
Mod_python 3.5.0

二、报错

安装到make时报错如下

[php]

[root@jkhost mod_python-3.5.0]# make
make[1]: 进入目录“/home/soft/mod_python-3.5.0/src”
fatal: Not a git repository (or any of the parent directories): .git

Building mod_python.so.

[/php]

安装到make install时报错如下

[php]

  File "/usr/lib64/python2.7/site-packages/mod_python/version.py", line 3
    version = "fatal: Not a git repository (or any of the parent directories): .git
[/php]

安装后测试打开网页报错500内部服务器错误,后查看apache日志如下

 

[php]

[Wed Nov 05 17:43:41.152959 2014] [mpm_event:notice] [pid 17684:tid 140084817590080] AH00494: SIGHUP received.  Attempting to re
start
[Wed Nov 05 17:43:41.177288 2014] [:notice] [pid 17684:tid 140084817590080] mod_python: Creating 8 session mutexes based on 6 ma
x processes and 25 max threads.
[Wed Nov 05 17:43:41.177308 2014] [:notice] [pid 17684:tid 140084817590080] mod_python: using mutex_directory /tmp
[Wed Nov 05 17:43:41.185126 2014] [mpm_event:notice] [pid 17684:tid 140084817590080] AH00489: Apache/2.4.10 (Unix) OpenSSL/1.0.1
e-fips mod_python/3.5.0- Python/2.7.5 configured -- resuming normal operations
[Wed Nov 05 17:43:41.185161 2014] [core:notice] [pid 17684:tid 140084817590080] AH00094: Command line: '/usr/local/apache/bin/ht
tpd'
[Wed Nov 05 17:43:44.022996 2014] [:error] [pid 18362:tid 140084485535488] make_obcallback: could not import mod_python.apache.\
n
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/mod_python/__init__.py", line 25, in <module>
    from . import version
  File "/usr/lib64/python2.7/site-packages/mod_python/version.py", line 3
    version = "fatal: Not a git repository (or any of the parent directories): .git
                                                                                  ^
SyntaxError: EOL while scanning string literal
[Wed Nov 05 17:43:44.023084 2014] [:error] [pid 18362:tid 140084485535488] make_obcallback: Python path being used "['/usr/lib64
/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7
/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/gtk-2.0
', '/usr/lib/python2.7/site-packages']".
[Wed Nov 05 17:43:44.023088 2014] [:error] [pid 18362:tid 140084485535488] get_interpreter: no interpreter callback found.

[/php]

1415182420_543106

三、解决方法

[php]

[root@jkhost soft]# tar -zxvf mod_python-3.5.0.tgz

[root@jkhost soft]# cd mod_python-3.5.0/

[root@jkhost mod_python-3.5.0]# ./configure --with-apxs=/usr/local/apache/bin/apxs --with-python=/usr/local/python/bin/python

[root@jkhost mod_python-3.5.0]#vim src/Makefile

version.c:
@MP_GIT_SHA=$$(git describe --always); \
echo > version.c ; \
echo "/* THIS FILE IS AUTO-GENERATED BY Makefile */" >> version.c ; \
echo "#include \"mp_version.h\"" >> version.c ; \
include/mod_python.h include/psp_flex.h include/psp_parser.h \
include/requestobject.h include/tableobject.h include/connobject.h \
include/finfoobject.h include/hlistobject.h include/mp_version.h \
include/_pspmodule.h include/psp_string.h include/serverobject.h \
include/util.h

[/php]

把@MP_GIT_SHA=$$(git describe --always); \改为@MP_GIT_SHA=$$(); \

[php]

[root@jkhost mod_python-3.5.0]vim dist/version.sh

#!/bin/sh

MPV_PATH="`dirname $0`/../src/include/mp_version.h"

MAJ=`awk '/MP_VERSION_MAJOR/ {print $3}' $MPV_PATH`
MIN=`awk '/MP_VERSION_MINOR/ {print $3}' $MPV_PATH`
PCH=`awk '/MP_VERSION_PATCH/ {print $3}' $MPV_PATH`
GIT=`git describe --always`

echo $MAJ.$MIN.$PCH-$GIT

[/php]

把GIT=`git describe --always`改为GIT=``

[php]

[root@jkhost mod_python-3.5.0]make

[root@jkhost mod_python-3.5.0]make install

[/php]

完成!

 

 

评论

2条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注