python-2.7 - 获取导入错误 : cannot import name OrderedDict

标签 python-2.7 kombu

我收到错误

ImportError: cannot import name OrderedDict



在我的 ubuntu 14.04 机器上本地安装服务器时。我尝试手动安装ordereddict,也尝试升级kombu,但它仍然给出错误。完整的回溯添加如下-

rishav@Swastik:~/open-event-orga-server$ sudo python create_db.py
Traceback (most recent call last): File "create_db.py", line 5, in
from app import current_app
File "/home/rishav/open-event-orga-server/app/init.py", line 23, in
from celery import Celery
File "/usr/local/lib/python2.7/dist-packages/celery/init.py", line 133, in
from celery import five # noqa File "/usr/local/lib/python2.7/dist-packages/celery/five.py", line 153, in
from kombu.utils.compat import OrderedDict # noqa
ImportError: cannot import name OrderedDict

最佳答案

这解决了我的问题:

  • 将昆布降级到 2.5.16。
  • 重新安装 django-celery

  • 这是日志:
    (virtualEnv) D:\Project\staging\modone\settings>pip install django-celery
    Collecting django-celery
      Downloading django_celery-3.2.1-py2-none-any.whl (63kB)
        100% |################################| 71kB 83kB/s
    Collecting django>=1.8 (from django-celery)
      Using cached Django-1.10.5-py2.py3-none-any.whl
    Collecting celery<4.0,>=3.1.15 (from django-celery)
      Downloading celery-3.1.25-py2.py3-none-any.whl (526kB)
        100% |################################| 532kB 122kB/s
    Requirement already satisfied: pytz>dev in d:\project\installations\virtualenv\lib\site-packages (from celery<4.0,>=3.1.15->django-celery)
    Collecting kombu<3.1,>=3.0.37 (from celery<4.0,>=3.1.15->django-celery)
      Using cached kombu-3.0.37-py2.py3-none-any.whl
    Collecting billiard<3.4,>=3.3.0.23 (from celery<4.0,>=3.1.15->django-celery)
      Downloading billiard-3.3.0.23-cp27-none-win32.whl (102kB)
        100% |################################| 102kB 114kB/s
    Requirement already satisfied: anyjson>=0.3.3 in d:\project\installations\virtualenv\lib\site-packages (from kombu<3.1,>=3.0.37->celery<4.0,>=3.1.15->
    django-celery)
    Collecting amqp<2.0,>=1.4.9 (from kombu<3.1,>=3.0.37->celery<4.0,>=3.1.15->django-celery)
      Using cached amqp-1.4.9-py2.py3-none-any.whl
    Installing collected packages: django, amqp, kombu, billiard, celery, django-celery
      Found existing installation: Django 1.4.5
        Uninstalling Django-1.4.5:
          Successfully uninstalled Django-1.4.5
      Found existing installation: amqp 1.0.13
        Uninstalling amqp-1.0.13:
          Successfully uninstalled amqp-1.0.13
      Found existing installation: kombu 2.5.16
        Uninstalling kombu-2.5.16:
          Successfully uninstalled kombu-2.5.16
      Found existing installation: billiard 2.7.3.28
        Uninstalling billiard-2.7.3.28:
          Successfully uninstalled billiard-2.7.3.28
      Found existing installation: celery 3.0.18
        Uninstalling celery-3.0.18:
          Successfully uninstalled celery-3.0.18
    Successfully installed amqp-1.4.9 billiard-3.3.0.23 celery-3.1.25 django-1.10.5 django-celery-3.2.1 kombu-3.0.37
    

    关于python-2.7 - 获取导入错误 : cannot import name OrderedDict,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41417647/

    相关文章:

    django - celery 减慢django

    python - 统一python 2/3版本支持类型

    django - 如何修复我的 Django ImproperlyConfigured 异常?

    python - 在ubuntu上导入caffe时ImportError cannot import name BytesIO

    flask - 无法为交换路由消息 'reply.celery.pidbox' : Table empty or key no longer exists

    python - 使用多线程使用 rabbitmq 消息队列 (Python Kombu)

    python-2.7 - Cassandra - ubuntu 16.04::无法启动 cassandra.service:找不到单元 cassandra.service

    Python Linux 读取进程内存 - int 太大而无法转换为 C long

    rabbitmq - Celery RabbitMQ 代理故障转移连接问题

    Django 、 celery 和昆布 : how to allow pickle?