Python Base.py:Unicode相等比较无法在中将两个参数转换为Unicode

Python Base.py:Unicode相等比较无法在中将两个参数转换为Unicode,python,django,unicode,Python,Django,Unicode,我正在看一些关于同一问题的相关问题,但我仍然没有找到解决方法 事实证明,每次我执行与Django相关的命令时,它都会打印出预期的输出加上如下内容: /Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py:307: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting th

我正在看一些关于同一问题的相关问题,但我仍然没有找到解决方法

事实证明,每次我执行与Django相关的命令时,它都会打印出预期的输出加上如下内容:

/Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py:307: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
return name == ":memory:" or "mode=memory" in force_text(name)
下面是这一行的上下文:

def is_in_memory_db(self, name):
    return name == ":memory:" or "mode=memory" in force_text(name)
尽管Django服务器工作正常,但总是在我的屏幕上打印这条消息还是有点烦人。那么,为什么会发生这种情况,以及如何解决这种情况呢?

用于进行正确的比较:

name.decode('utf-8') == ":memory:" or "mode=memory" in force_text(name)
使用完整信息:

使用decode()而不是encode(),它起作用了。谢谢你可能的副本