我正在尝试安装mod_python,但遇到了一个错误:
SyntaxError: ('EOL while scanning string literal', ('/usr/local/lib/python2.7/dist-packages/mod_python/version.py', 3, 79, 'version = "fatal: Not a git repository (or any of the parent directories): .git\n'))这是在version.sh中使用的mod_python文件。
#!/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我手动运行,然后得到:
fatal: Not a git repository (or any of the parent directories): .git
3.4.1-这是什么意思?救命啊!!
谢谢!
发布于 2013-11-16 20:00:56
version.sh文件假设您是从git安装的。那好像是个虫子。
要修复它,可以删除行。
GIT=`git describe --always`并将下一行更改为
echo $MAJ.$MIN.$PCH发布于 2015-04-23 11:10:25
在执行之前,我使用这个shell命令在根源树中修补Makefile*文件和version.sh文件。/配置:
sed \
-e 's/(git describe --always)/(git describe --always 2>\/dev\/null)/g' \
-e 's/`git describe --always`/`git describe --always 2>\/dev\/null`/g' \
-i $( find . -type f -name Makefile\* -o -name version.sh )发布于 2017-02-22 16:46:15
我有同样的症状,但在一个稍微不同的环境。这是在Gentoo linux上实现的(尽管在2017年,由于Gentoo的根本变化,我还没有做好投资),已经有1-2年没有做过大的系统更新了。张贴在这里,以防万一,它帮助一个人有同样的基本问题(因为它花了我一个坚实的~3个小时来解决它)。
我安装了mod_python (使用出现),重新启动了Apache服务,添加了一个测试python页面,并在web浏览器中导航到它。以下是我在网页上得到的信息:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, ... and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.31 (Gentoo) DAV/2 mod_ssl/2.2.31 OpenSSL/1.0.2j mod_python/3.5.0- Python/2.7.5 SVN/1.8.14 PHP/5.5.16-pl0-gentoo Server at localhost Port 80在安装mod_python并尝试测试之后,我在Apache的错误日志中找到了以下内容:
[Wed Feb 22 11:34:05 2017] [notice] mod_python: Creating 8 session mutexes based on 10 max processes and 1 max threads.
[Wed Feb 22 11:34:05 2017] [notice] mod_python: using mutex_directory /tmp
[Wed Feb 22 11:34:05 2017] [notice] Apache/2.2.31 (Unix) DAV/2 mod_ssl/2.2.31 OpenSSL/1.0.2j mod_python/3.5.0- Python/2.7.5 SVN/1.8.14 PHP/5.5.16-pl0-gentoo configured -- resuming normal operations
[Wed Feb 22 11:34:21 2017] [error] make_obcallback: could not import mod_python.apache.\n
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/mod_python/__init__.py", line 25, in <module>
from . import version
File "/usr/lib/python2.7/site-packages/mod_python/version.py", line 3
version = "fatal: Not a git repository (or any parent up to mount point /var)
^
SyntaxError: EOL while scanning string literal
[Wed Feb 22 11:34:21 2017] [error] make_obcallback: Python path being used "['/usr/lib/python2.7/site-packages/Genshi-0.7-py2.7-linux-i686.egg', '/usr/lib/python2.7/site-packages/Trac-1.2-py2.7.egg', '/usr/lib/python27.zip', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/lib/python2.7/site-packages', '/usr/lib/python2.7/site-packages/gst-0.10', '/usr/lib/python2.7/site-packages/gtk-2.0', '/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode']".
[Wed Feb 22 11:34:21 2017] [error] get_interpreter: no interpreter callback found.因此,根据它正在调用的python文件的路径(ex )。"/usr/lib/python2.7/site-packages/mod_python/init.py")我至少可以确认一堆东西是正确工作的:
我注意到了这些项目,因为在有限的和不完全描述性的消息之间(至少对于新手来说),还有很多东西需要考虑或拼凑在一起。
最后,我查看了跟踪中文件的实际Python源代码。
查看跟踪中的实际代码(从init.py开始),我看到它以version = "fatal: Not a git repository ..."结尾。查看此文件( version.py )以及某个网站的附带说明,我认为问题在于,生成version.py的脚本(根据version.py中的标题生成“setup.py”)假定它是从Git克隆运行的,并报告了一些致命错误,而情况并非如此。脚本盲目地将错误消息加上版本变量中的版本:
version = "fatal: Not a git repository (or any parent up to mount point /var)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
3.5.0-"因此,我所要做的就是将这个变量设置为一个有效值:
version = "3.5.0-"(注意:如果您关心的话,mod_python的版本似乎位于原始字符串的末尾。)
重新启动Apache和Python在我的测试网页上运行得很好。
https://stackoverflow.com/questions/20022952
复制相似问题