Django / Celery找不到importlib

时间:2010-10-09 18:55:09

标签: python django celery

所以我刚刚将django更新为1.2.3,现在当我尝试运行'python manage.py shell'在django环境中工作时,我收到以下错误。

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

任何想法。我似乎无法找到这里发生的事情而且我可以告诉我在我的网络服务器上运行相同的版本并且我没有出现相同的错误。

2 个答案:

答案 0 :(得分:8)

我认为,在Python 2.7 / 3.1中添加了importlib。您可以在此处下载pyton 2.5的端口:

同时检查setup.cfg底部附近的芹菜,确保满足所有其他要求(在脚本底部)。

答案 1 :(得分:1)

在3.1版本中将importlib添加到Python中,然后向后移植到Python 2.7。 PyPI上提供第三方backport。

另请注意,“向后移植到2.7”并不意味着2.7之后的所有版本都将具有importlib。我相信Python 3.0确实有importlib。