AttributeError:在服务器更新后,'module'对象在dreamhost上没有属性'pydebug' [英] AttributeError: 'module' object has no attribute 'pydebug' on dreamhost after server update

查看:107
本文介绍了AttributeError:在服务器更新后,'module'对象在dreamhost上没有属性'pydebug'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Dreamhost共享服务器上的这个错误,可以自定义安装python。我在几个月前使用本教程进行安装:

I have this error on a dreamhost shared server with a custom installation of python. I used this tutorial for the installation months ago:

在本周末,Dreamhost(ubuntu 12.04)的服务器更新后,出现这种错误:

after the update of the servers of dreamhost (to ubuntu 12.04) this weekend, this error showed up:

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'

我尝试这些东西,没有工作:

I try these things and did not work:


  • 重新安装自定义python

  • 更改PYTHONPATH

  • 在dreamhost中创建一个新用户,开始

  • 安装virtualenv没有自定义python。

  • Reinstall custom python
  • Change PYTHONPATH
  • Create a new user in dreamhost for a fresh start
  • Install virtualenv without custom python.

我认为问题是python的路径,但我不知道如何改变它。

I think the problem is the path of python, but i dont know how change it.

编辑1:我尝试使用./configure命令中的 - with-pydebug 安装自定义python 。没有工作。

EDIT 1: I tried install custom python with --with-pydebug on ./configure command. Did not work.

推荐答案

只需将文件 passenger_wsgi.py

Just put in the file passenger_wsgi.py these lines

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解释器。

This forces passenger_wsgi.py to use the python interpreter installed in the virtualenv.

这篇关于AttributeError:在服务器更新后,'module'对象在dreamhost上没有属性'pydebug'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆