gpt4 book ai didi

python-3.x - 如何修复 ‘AttributeError: cffi library ' _constant_time' 在 django 中没有名为 '__spec__' 的函数、常量或全局变量的错误”

转载 作者:行者123 更新时间:2023-12-04 13:58:33 25 4
gpt4 key购买 nike

我想导入请求库(在 views.py 中)以从其他网站请求一些信息。但是有一个像标题这样的错误

在 ivews.py 中

from django.http import HttpResponse

from django.http import JsonResponse

from django.core import serializers

import requests

import json

AttributeError: cffi library '_constant_time' has no function, constant or global variable named 'spec'



上述异常是以下异常的直接原因:

Traceback (most recent call last): File "C:/Users/49646/Desktop/auto_order/manage.py", line 21, in
..... if not isinstance(module, ModuleType) or getattr(module, 'spec', None) is None: SystemError: returned a result with an error set

最佳答案

@John-Doe notes in the comments , 升级 cffi到最新版本(现在是 1.14.5)修复了这个完全相同的错误。我已经在 MacOS X 10.14 上使用 Django 3.x 亲自证实了这一点。

关于python-3.x - 如何修复 ‘AttributeError: cffi library ' _constant_time' 在 django 中没有名为 '__spec__' 的函数、常量或全局变量的错误”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56528946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com