【问题标题】:django_graphene looking for package "six" in the wrong place?django_graphene 在错误的地方寻找包“六”?
【发布时间】:2019-10-14 19:20:23
【问题描述】:

我正在尝试使用graphene-django,但“六”包存在一些问题。已经安装了,不过是作为自己的包安装的,graphene-django 好像在django.utils下面期待它

  File "C:\Users\mjnic\.virtualenvs\phoenix-demo-C42C_PgQ\lib\site-packages\graphene_django\settings.py", line 18, in <module>
    from django.utils import six
ImportError: cannot import name 'six' from 'django.utils' (C:\Users\mjnic\.virtualenvs\phoenix-demo-C42C_PgQ\lib\site-packages\django\utils\__init__.py)

六人之路:

>>> import six
>>> print(six.__file__)
C:\Users\mjnic\.virtualenvs\phoenix-demo-C42C_PgQ\lib\site-packages\six.py

我检查了graphene_django 的来源,在settings.py 中,它似乎专门针对django 路径。

This module provides the `graphene_settings` object, that is used to access
Graphene settings, checking for user settings first, then falling
back to the defaults.
"""
from __future__ import unicode_literals

from django.conf import settings
from django.test.signals import setting_changed
from django.utils import six

我正在使用 pipenv 来管理我的环境,并且我已经卸载并重新安装了六个,并且现在多次尝试解决各种石墨烯包,但无济于事。

那么我该如何移动six 的安装,使其位于django.utils.six,或者更改设置,以便graphene-django 正在查看当前安装的位置(看起来不可能查看资源)?

【问题讨论】:

    标签: django six graphene-django


    【解决方案1】:

    经过一番挫折,我找到了答案。我的Pipfile 实际上指定了Django = "*"(是的,我知道...),并且似乎six 已从版本3 中的django.utils 中删除。将版本指定为&lt;3.0 并且降级似乎已修复我的问题!

    有关 graphene-django 的问题报告,请参见此处。对于面临同样问题的其他人来说可能很方便。

    https://github.com/graphql-python/graphene-django/issues/771

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-25
      • 2020-02-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多