3

所以我刚刚将 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

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

4

2 回答 2

8

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

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

于 2010-10-09T22:17:43.167 回答
1

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

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

于 2010-10-10T02:25:13.090 回答