2010-10-09 121 views
3

所以我只是更新django到1.2.3,現在當我嘗試運行'python manage.py shell'在django環境中工作時,出現以下錯誤。Django /芹菜找不到importlib

Traceback (most recent call last): 


File "manage.py", line 11, in <module> 
    execute_manager(settings) 
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/__init__.py", line 438, in execute_manager 
    utility.execute() 
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/__init__.py", line 379, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/base.py", line 191, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/base.py", line 220, in execute 
    output = self.handle(*args, **options) 
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/management/base.py", line 351, in handle 
    return self.handle_noargs(**options) 
    File "/opt/local/lib/python2.5/site-packages/django/core/management/commands/shell.py", line 18, in handle_noargs 
    loaded_models = get_models() 
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/loading.py", line 167, in get_models 
    self._populate() 
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/loading.py", line 64, in _populate 
    self.load_app(app_name) 
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/loading.py", line 78, in load_app 
    models = import_module('.models', app_name) 
    File "/opt/local/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 
    File "/opt/local/lib/python2.5/site-packages/django_celery-2.0.3-py2.5.egg/djcelery/models.py", line 7, in <module> 
    from celery import conf 
    File "/opt/local/lib/python2.5/site-packages/celery-2.0.3-py2.5.egg/celery/conf.py", line 6, in <module> 
    from celery import routes 
    File "/opt/local/lib/python2.5/site-packages/celery-2.0.3-py2.5.egg/celery/routes.py", line 2, in <module> 
    from celery.utils import instantiate, firstmethod, mpromise 
    File "/opt/local/lib/python2.5/site-packages/celery-2.0.3-py2.5.egg/celery/utils/__init__.py", line 9, in <module> 
    import importlib 
ImportError: No module named importlib 

任何想法。我似乎無法找到這裏發生了什麼,盡我所能告訴我在我的Web服務器上運行相同的版本,並且我沒有顯示相同的錯誤。

+0

如果不是Python版本的一部分,芹菜應該添加importlib作爲依賴項。如果你沒有通過正常的路由安裝,你可以自己安裝importlib:easy_install -U importlib – asksol 2010-10-11 08:57:59

回答

1

importlib已在版本3.1中添加到Python中,然後回溯到Python 2.7。第三方backports在PyPI上可用。

另請注意,'backported to 2.7'並不意味着2.7之後的所有版本都會有importlib。 Python 3.0,我相信,不是有importlib。