1

我已经安装并可能正确配置了 apache2、mod_wsgi 和 python 2.7.5。问题是 127.0.0.1 没有打开(加载只是冻结),我在 error.log 中看到以下日志:

    [Wed Jun 19 14:49:11 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.4 Python/2.7.3 configured -- resuming normal operations
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site.py", line 548, in <module>
    main()
  File "/usr/local/lib/python2.7/site.py", line 530, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/local/lib/python2.7/site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/local/lib/python2.7/site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/lib/python2.7/site.py", line 231, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/local/lib/python2.7/sysconfig.py", line 516, in get_config_var
    return get_config_vars().get(name)
  File "/usr/local/lib/python2.7/sysconfig.py", line 449, in get_config_vars
    import re
  File "/usr/local/lib/python2.7/re.py", line 105, in <module>
    import sre_compile
  File "/usr/local/lib/python2.7/sre_compile.py", line 14, in <module>
    import sre_parse
  File "/usr/local/lib/python2.7/sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "/usr/local/lib/python2.7/sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT  

试图重新启动apache,但它不起作用。谢谢你的帮助!

4

1 回答 1

2

刚刚找到解决方案。我在 python 的解释器中检查了 'sys.prefix' 并打印了 '/usr/local',但我没有在 apache 配置中设置 WSGIPythonHome(如本例的 mod_wsgi 文档中所写)。只是为了实验,我设置了 'WSGIPythonHome /usr'。这很奇怪,但它解决了我的问题,现在一切都很好!

于 2013-06-20T09:45:29.207 回答