我在Dreamhost共享服务器上使用python的自定义安装时出现此错误。我在几个月前使用this tutorial进行了安装:
本周末更新了dreamhost服务器(到ubuntu 12.04)之后,出现了这个错误:
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 562, in <module>
main()
File "/usr/lib/python2.7/site.py", line 544, in main
known_paths = addusersitepackages(known_paths)
File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
user_site = getusersitepackages()
File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python2.7/site.py", line 236, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var
return get_config_vars().get(name)
File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/lib/python2.7/sysconfig.py", line 337, in _init_posix
makefile = _get_makefile_filename()
File "/usr/lib/python2.7/sysconfig.py", line 331, in _get_makefile_filename
return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile")
AttributeError: 'module' object has no attribute 'pydebug'
我尝试这些东西并没有奏效:
我认为问题是python的路径,但我不知道如何改变它。
编辑1:我尝试在./configure命令上使用 - with-pydebug 安装自定义python。没用。
答案 0 :(得分:1)
只需输入文件 passenger_wsgi.py 这些行
即可INTERP = cwd + "/env/bin/python"
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)
而不是
#Switch to new python
if sys.version < "2.7.7": os.execl(cwd+"/env/bin/python", "python2.7", *sys.argv)
强制 passenger_wsgi.py 使用virtualenv中安装的python解释器。